bwapi 9.0.0.pre.349 → 9.0.0.pre.364
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +8 -8
- data/.gitignore +1 -1
- data/.rubocop.yml +3 -0
- data/.travis.yml +0 -3
- data/Gemfile +3 -3
- data/README.md +0 -1
- data/bin/bwapi +0 -1
- data/bwapi.gemspec +6 -9
- data/lib/bwapi.rb +16 -14
- data/lib/bwapi/client.rb +65 -16
- data/lib/bwapi/client/admin.rb +0 -2
- data/lib/bwapi/client/admin/become.rb +0 -2
- data/lib/bwapi/client/admin/search.rb +0 -2
- data/lib/bwapi/client/admin/sub_clients.rb +0 -2
- data/lib/bwapi/client/admin/users.rb +0 -2
- data/lib/bwapi/client/admin/users/sharing.rb +0 -2
- data/lib/bwapi/client/brandwatch.rb +0 -2
- data/lib/bwapi/client/brandwatch/become.rb +0 -2
- data/lib/bwapi/client/brandwatch/client_modules.rb +0 -1
- data/lib/bwapi/client/client.rb +0 -2
- data/lib/bwapi/client/command_center.rb +0 -2
- data/lib/bwapi/client/command_center/client.rb +0 -2
- data/lib/bwapi/client/command_center/displays.rb +0 -2
- data/lib/bwapi/client/command_center/displays/events.rb +0 -2
- data/lib/bwapi/client/command_center/displays/messages.rb +0 -1
- data/lib/bwapi/client/command_center/displays/scenes.rb +0 -2
- data/lib/bwapi/client/command_center/displays/screens.rb +0 -2
- data/lib/bwapi/client/command_center/displays/users.rb +0 -2
- data/lib/bwapi/client/command_center/displays/users/access.rb +0 -1
- data/lib/bwapi/client/command_center/scene_types.rb +0 -2
- data/lib/bwapi/client/command_center/themes.rb +0 -2
- data/lib/bwapi/client/command_center/users.rb +0 -2
- data/lib/bwapi/client/command_center/users/access.rb +0 -2
- data/lib/bwapi/client/error_codes.rb +0 -2
- data/lib/bwapi/client/filters.rb +0 -2
- data/lib/bwapi/client/languages.rb +0 -2
- data/lib/bwapi/client/locations.rb +0 -2
- data/lib/bwapi/client/logout.rb +0 -3
- data/lib/bwapi/client/me.rb +2 -11
- data/lib/bwapi/client/metrics.rb +0 -2
- data/lib/bwapi/client/oauth.rb +0 -3
- data/lib/bwapi/client/ping.rb +0 -2
- data/lib/bwapi/client/projects.rb +0 -2
- data/lib/bwapi/client/projects/bulkactions.rb +0 -2
- data/lib/bwapi/client/projects/bulkactions/author.rb +0 -2
- data/lib/bwapi/client/projects/bulkactions/mentions.rb +0 -2
- data/lib/bwapi/client/projects/categories.rb +0 -2
- data/lib/bwapi/client/projects/categories/copy.rb +0 -2
- data/lib/bwapi/client/projects/data.rb +0 -1
- data/lib/bwapi/client/projects/data/mentions.rb +0 -1
- data/lib/bwapi/client/projects/data/mentions/notes.rb +0 -2
- data/lib/bwapi/client/projects/data/volume.rb +0 -2
- data/lib/bwapi/client/projects/data_download.rb +0 -2
- data/lib/bwapi/client/projects/demographics.rb +0 -1
- data/lib/bwapi/client/projects/facebook_queries.rb +0 -2
- data/lib/bwapi/client/projects/group.rb +0 -1
- data/lib/bwapi/client/projects/group/author_group.rb +0 -2
- data/lib/bwapi/client/projects/group/location_group.rb +0 -1
- data/lib/bwapi/client/projects/group/site_group.rb +0 -1
- data/lib/bwapi/client/projects/queries.rb +0 -2
- data/lib/bwapi/client/projects/queries/backfill.rb +0 -1
- data/lib/bwapi/client/projects/queries/date_range.rb +0 -2
- data/lib/bwapi/client/projects/queries/mentions.rb +0 -1
- data/lib/bwapi/client/projects/query_groups.rb +0 -1
- data/lib/bwapi/client/projects/rules.rb +0 -1
- data/lib/bwapi/client/projects/rules/backfill.rb +0 -2
- data/lib/bwapi/client/projects/rules/copy.rb +0 -2
- data/lib/bwapi/client/projects/sharing.rb +0 -2
- data/lib/bwapi/client/projects/signals.rb +0 -2
- data/lib/bwapi/client/projects/stream_dashboards.rb +0 -2
- data/lib/bwapi/client/projects/stream_dashboards/streams.rb +0 -1
- data/lib/bwapi/client/projects/summary.rb +0 -2
- data/lib/bwapi/client/projects/tags.rb +0 -2
- data/lib/bwapi/client/projects/twitter_queries.rb +0 -2
- data/lib/bwapi/client/projects/users.rb +0 -2
- data/lib/bwapi/client/projects/workflow.rb +0 -2
- data/lib/bwapi/client/query_validation.rb +0 -2
- data/lib/bwapi/client/sso.rb +0 -2
- data/lib/bwapi/client/test_search.rb +0 -2
- data/lib/bwapi/client/user.rb +0 -2
- data/lib/bwapi/client/user/notifications.rb +0 -2
- data/lib/bwapi/configuration.rb +40 -56
- data/lib/bwapi/connection.rb +32 -14
- data/lib/bwapi/default.rb +91 -0
- data/lib/bwapi/error.rb +1 -3
- data/lib/bwapi/performance.rb +39 -0
- data/lib/bwapi/request.rb +6 -33
- data/lib/bwapi/response/error.rb +28 -0
- data/lib/bwapi/response/logger.rb +35 -0
- data/lib/bwapi/response/performance.rb +31 -0
- data/lib/bwapi/version.rb +0 -2
- data/spec/bwapi/client_spec.rb +55 -49
- data/spec/bwapi_spec.rb +1 -3
- data/spec/helper.rb +1 -4
- metadata +32 -47
- data/lib/bwapi/authentication.rb +0 -48
- data/lib/faraday/response/brandwatch_error.rb +0 -25
- data/spec/bwapi/authentication_spec.rb +0 -57
- data/spec/fixtures/.netrc +0 -3
checksums.yaml
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
---
|
|
2
2
|
!binary "U0hBMQ==":
|
|
3
3
|
metadata.gz: !binary |-
|
|
4
|
-
|
|
4
|
+
YjJlMmJiYWUwMDE3ZjlhNmRmMDE5NGZmZWVlYWZiYmQ3MjQ3Y2YwYg==
|
|
5
5
|
data.tar.gz: !binary |-
|
|
6
|
-
|
|
6
|
+
YTIzMjA0ZWU3NmYxYjgxY2FlMjg5ZTc2ODg3MGVkNTgzYzYxZGJiYQ==
|
|
7
7
|
SHA512:
|
|
8
8
|
metadata.gz: !binary |-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
NmIyNGY1YzEzNTg2NmY5MGVjMDczNTg0ODlkNGU0MzZlYjdmOTBkZDliYzcx
|
|
10
|
+
MDk1ZTU3NjMyMmVmMDNhNjdlMjY2MDYwY2MyYTM3YjMyYmI4NTRkMzFmN2E4
|
|
11
|
+
NTEzMzE4MzcyYWE2MWI5MDc2YTg1ZTU2ZGU2MzZjZWQyOWFlZDI=
|
|
12
12
|
data.tar.gz: !binary |-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
ZDZlMTc5YTA5MDRiZjIwYmEwZjJmM2M0M2ZlZmI3NThkOTVhMjdiM2QwNzM2
|
|
14
|
+
YTEyM2IxNTEwOTczYWFjYTc4NWE5NzY0NTE4N2FmMTI1Y2NlYzNhNjIxOWJi
|
|
15
|
+
ZGRlNmQ4N2UwYmNhNWZhZjBhZGU0NTNmYTNhY2U0NjI1YzMxMGM=
|
data/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
[](https://bitdeli.com/free "Bitdeli Badge")
|
|
2
1
|
[](http://badge.fury.io/rb/bwapi)
|
|
3
2
|
[](https://travis-ci.org/jonathanchrisp/bwapi)
|
|
4
3
|
[](https://gemnasium.com/jonathanchrisp/bwapi)
|
data/bin/bwapi
CHANGED
data/bwapi.gemspec
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
# encoding: utf-8
|
|
2
|
-
|
|
3
1
|
require File.dirname(__FILE__) + '/lib/bwapi/version'
|
|
4
2
|
|
|
5
3
|
Gem::Specification.new do |s|
|
|
6
4
|
s.name = 'bwapi'
|
|
7
5
|
s.version = BWAPI::VERSION
|
|
8
6
|
s.version = BWAPI::VERSION + ".pre.#{ENV['TRAVIS_BUILD_NUMBER']}" if ENV['TRAVIS']
|
|
9
|
-
s.date = '2014-
|
|
7
|
+
s.date = '2014-08-04'
|
|
10
8
|
s.summary = 'Brandwatch API Wrapper'
|
|
11
9
|
s.description = 'A Ruby wrapper for the Brandwatch API'
|
|
12
10
|
s.author = 'Jonathan Chrisp'
|
|
@@ -15,14 +13,13 @@ Gem::Specification.new do |s|
|
|
|
15
13
|
s.homepage = 'https://github.com/jonathanchrisp/bwapi'
|
|
16
14
|
s.required_ruby_version = '>= 1.9.2'
|
|
17
15
|
|
|
18
|
-
s.add_development_dependency 'rspec', '~>
|
|
19
|
-
s.add_development_dependency 'rubocop', '~> 0.
|
|
16
|
+
s.add_development_dependency 'rspec', '~> 3.0.0', '>= 3.0.0'
|
|
17
|
+
s.add_development_dependency 'rubocop', '~> 0.24.1', '>= 0.24.1'
|
|
20
18
|
|
|
21
|
-
s.add_runtime_dependency '
|
|
19
|
+
s.add_runtime_dependency 'allotment', '~> 1.1.0', '>= 1.1.0'
|
|
22
20
|
s.add_runtime_dependency 'faraday', '~> 0.9.0', '>= 0.9.0'
|
|
23
|
-
s.add_runtime_dependency 'faraday_middleware', '~> 0.9.
|
|
24
|
-
s.add_runtime_dependency 'hashie', '~> 2.
|
|
25
|
-
s.add_runtime_dependency 'netrc', '~> 0.7.7', '>= 0.7.7'
|
|
21
|
+
s.add_runtime_dependency 'faraday_middleware', '~> 0.9.1', '>= 0.9.1'
|
|
22
|
+
s.add_runtime_dependency 'hashie', '~> 3.2.0', '>= 3.2.0'
|
|
26
23
|
|
|
27
24
|
s.files = `git ls-files`.split("\n")
|
|
28
25
|
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
data/lib/bwapi.rb
CHANGED
|
@@ -1,29 +1,31 @@
|
|
|
1
|
-
# encoding: utf-8
|
|
2
|
-
|
|
3
|
-
require 'bwapi/version'
|
|
4
|
-
require 'bwapi/configuration'
|
|
5
|
-
require 'bwapi/error'
|
|
6
1
|
require 'bwapi/client'
|
|
2
|
+
require 'bwapi/default'
|
|
7
3
|
|
|
8
|
-
#
|
|
4
|
+
# Ruby wrapper for the Brandwatch API
|
|
9
5
|
module BWAPI
|
|
10
|
-
extend Configuration
|
|
11
6
|
class << self
|
|
7
|
+
include BWAPI::Configuration
|
|
8
|
+
|
|
12
9
|
# Alias for BWAPI::Client.new
|
|
13
10
|
#
|
|
14
11
|
# @return [BWAPI::Client]
|
|
15
12
|
def new(opts = {})
|
|
16
|
-
BWAPI::Client.new
|
|
13
|
+
BWAPI::Client.new(opts)
|
|
17
14
|
end
|
|
18
15
|
|
|
19
|
-
#
|
|
20
|
-
def
|
|
21
|
-
|
|
22
|
-
new.send method, *args, &block
|
|
16
|
+
# Check BWAPI::Client.new responds
|
|
17
|
+
def respond_to?(method_name, include_private = false)
|
|
18
|
+
new.respond_to?(method_name, include_private) || super
|
|
23
19
|
end
|
|
24
20
|
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
private
|
|
22
|
+
|
|
23
|
+
# Delegate to BWAPI::Client.new
|
|
24
|
+
def method_missing(method_name, *args, &block)
|
|
25
|
+
return super unless client.respond_to?(method_name)
|
|
26
|
+
new.send(method_name, *args, &block)
|
|
27
27
|
end
|
|
28
28
|
end
|
|
29
29
|
end
|
|
30
|
+
|
|
31
|
+
BWAPI.reset
|
data/lib/bwapi/client.rb
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
require 'bwapi/authentication'
|
|
1
|
+
require 'bwapi/configuration'
|
|
4
2
|
require 'bwapi/connection'
|
|
5
3
|
require 'bwapi/request'
|
|
4
|
+
require 'bwapi/performance'
|
|
6
5
|
|
|
7
6
|
require 'bwapi/client/admin'
|
|
8
7
|
require 'bwapi/client/brandwatch'
|
|
@@ -22,25 +21,15 @@ require 'bwapi/client/projects'
|
|
|
22
21
|
require 'bwapi/client/query_validation'
|
|
23
22
|
require 'bwapi/client/test_search'
|
|
24
23
|
require 'bwapi/client/user'
|
|
24
|
+
require 'faraday'
|
|
25
25
|
|
|
26
26
|
module BWAPI
|
|
27
27
|
# Client class to create BWAPI instances
|
|
28
28
|
class Client
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
def initialize(opts = {})
|
|
32
|
-
opts = BWAPI.options.merge(opts)
|
|
33
|
-
Configuration::OPTION_KEYS.each { |k| send("#{k}=", opts[k]) }
|
|
34
|
-
netrc_credentials opts[:netrc]
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
def destroy
|
|
38
|
-
Configuration::OPTION_KEYS.each { |k| send("#{k}=", nil) }
|
|
39
|
-
end
|
|
40
|
-
|
|
41
|
-
include BWAPI::Authentication
|
|
29
|
+
include BWAPI::Configuration
|
|
42
30
|
include BWAPI::Connection
|
|
43
31
|
include BWAPI::Request
|
|
32
|
+
include BWAPI::Performance
|
|
44
33
|
|
|
45
34
|
include BWAPI::Client::Admin
|
|
46
35
|
include BWAPI::Client::Brandwatch
|
|
@@ -60,5 +49,65 @@ module BWAPI
|
|
|
60
49
|
include BWAPI::Client::QueryValidation
|
|
61
50
|
include BWAPI::Client::TestSearch
|
|
62
51
|
include BWAPI::Client::User
|
|
52
|
+
|
|
53
|
+
# Initializes Client
|
|
54
|
+
#
|
|
55
|
+
# @params options [Hash] the configuration options
|
|
56
|
+
def initialize(options = {})
|
|
57
|
+
BWAPI::Configuration.keys.each do |key|
|
|
58
|
+
instance_variable_set(:"@#{key}", options[key] || BWAPI.instance_variable_get(:"@#{key}"))
|
|
59
|
+
end
|
|
60
|
+
end
|
|
61
|
+
|
|
62
|
+
# Check if user is authenicated
|
|
63
|
+
#
|
|
64
|
+
# @return [Boolean] Authenticated status
|
|
65
|
+
def authenticated?
|
|
66
|
+
@access_token ? true : false
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
# Check if user is a brandwatch-application-client type
|
|
70
|
+
#
|
|
71
|
+
# @return [Boolean] Application client status
|
|
72
|
+
def application_client?
|
|
73
|
+
@client_id == 'brandwatch-application-client' ? true : false
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
# Check if user is a brandwatch-api-client type
|
|
77
|
+
#
|
|
78
|
+
# @return [Boolean] Application client status
|
|
79
|
+
def api_client?
|
|
80
|
+
@client_id == 'brandwatch-api-client' ? true : false
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def access_token=(value)
|
|
84
|
+
reset_connection
|
|
85
|
+
@access_token = value
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
def api_endpoint=(value)
|
|
89
|
+
reset_connection
|
|
90
|
+
@api_endpoint = value
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def connection_options=(value)
|
|
94
|
+
reset_connection
|
|
95
|
+
@connection_options = value
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
def debug=(value)
|
|
99
|
+
reset_connection
|
|
100
|
+
@debug = value
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
def logger=(value)
|
|
104
|
+
reset_connection
|
|
105
|
+
@logger = value
|
|
106
|
+
end
|
|
107
|
+
|
|
108
|
+
def verify_ssl=(value)
|
|
109
|
+
reset_connection
|
|
110
|
+
@verify_ssl = value
|
|
111
|
+
end
|
|
63
112
|
end
|
|
64
113
|
end
|
data/lib/bwapi/client/admin.rb
CHANGED
data/lib/bwapi/client/client.rb
CHANGED
data/lib/bwapi/client/filters.rb
CHANGED
data/lib/bwapi/client/logout.rb
CHANGED