PLEASE NOTE THAT THIS PROJECT IS NOT OFFICIALLY SUPPORTED BY BRANDWATCH
A Ruby interface to the Brandwatch V2 API. The projects design is modelled on the GitHub Octokit wrapper which can be found here: https://github.com/octokit/octokit.rb.
http://rubydoc.info/gems/bwapi/
All Brandwatch API calls at present require you to be authenticated with the system. Therefore you'll need to create an instance of your client:
bw = BWAPI::Client.new(:username => '[email protected]', :password => 'pa$$w0rd')
Once you have your instance of your client you can then use a helper method to authenticate with Brandwatch:
bw.login
The wrapper returns a boolean value to state whether you authenticated successfully.
Once authenticated, you are then able to make additional requests. Please see a small selection of examples below:
bw.projects
=> #<Hashie::Mash results=[#<Hashie::Mash clientId=1856278873 clientName="JC BWAPI Demo" creationDate="2013-07-24T17:56:31.074+0000" creatorUserId=158304410 defaultIndustry="general-(recommended)" defaultLangCodes=["en"] description=nil id=1856280126 links=#<Hashie::Mash queries="http://newapi.brandwatch.com//projects/1856280126/queries.json?access_token=bd405bd7-9d1f-4c3d-ab5c-64b77791ae7f"> name="Demo Project">] resultsPage=-1 resultsPageSize=-1 resultsTotal=-1>
bw.project 1856280126
=> #<Hashie::Mash clientId=1856278873 clientName="JC BWAPI Demo" creationDate="2013-07-24T17:56:31.074+0000" creatorUserId=158304410 defaultIndustry="general-(recommended)" defaultLangCodes=["en"] description=nil id=1856280126 links=#<Hashie::Mash queries="http://newapi.brandwatch.com//projects/1856280126/queries.json?access_token=bd405bd7-9d1f-4c3d-ab5c-64b77791ae7f"> name="Demo Project">
bw.queries_summary 1856280126
=> #<Hashie::Mash results=[#<Hashie::Mash id=1856280351 name="LA Lakers">] resultsPage=-1 resultsPageSize=-1 resultsTotal=-1>
bw.me
=> #<Hashie::Mash client=#<Hashie::Mash id=1856278873 name="JC BWAPI Demo" parentId=-1 railsEnabled=false theme="brandwatch"> firstName="BWAPI" id=158304410 lastName="Demo" links=#<Hashie::Mash logout="http://newapi.brandwatch.com/logout?access_token=bd405bd7-9d1f-4c3d-ab5c-64b77791ae7f" user="http://newapi.brandwatch.com//user.json?access_token=bd405bd7-9d1f-4c3d-ab5c-64b77791ae7f"> tags=#<Hashie::Mash notify="true"> uiRole="admin" username="[email protected]">
There are a number of unit tests which are included as part of this project, please run:
rspec spec
Please note that a number of tests still need to be added so I don't currently have complete coverage, subject to workload these will be slowly added over the next few months.
I would be more than happy to recieve feedback, please email me at: [email protected] or [email protected]