bwapi 12.0.0 → 12.1.0.pre.646
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 +13 -5
- data/.travis.yml +5 -0
- data/lib/bwapi/client.rb +3 -0
- data/lib/bwapi/client/admin/reseller.rb +0 -14
- data/lib/bwapi/client/usage_summary.rb +20 -0
- data/lib/bwapi/configuration.rb +4 -1
- data/lib/bwapi/connection.rb +2 -0
- data/lib/bwapi/default.rb +8 -0
- data/lib/bwapi/version.rb +1 -1
- data/spec/bwapi/configuration_spec.rb +34 -4
- data/spec/bwapi/default_spec.rb +5 -3
- metadata +27 -27
checksums.yaml
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
YWE4YmU1MTRhZjNjYjBlZDdmNmVmNGFiOGExNTBmYzJjZjkwYmEyMw==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ZGQ0MzJiZTc3NDE5ZGQ3ZmM4MjgzNTZkNGMwOGI0YzYwMWFhNmI2NA==
|
5
7
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
MjVjZTNkOWQwZWM4N2Y2MGFmODMyNGJlZmU2OTZhNmVmMjc5NzNkYjMxOTVi
|
10
|
+
YTI0YzM1ZGE5ZDZmY2RiNWIzZDM4YmU5ZjkzYzdmNTczZDYxY2EyOTcxN2Nk
|
11
|
+
OWE2NTcwMmY3M2I5NWMwOGQ2Mzc0MGJjYzNhMDllYmVhOTQwOTY=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
MTU2ZDllOTNmOTQ2NmRlMjVhODM5MzdiMzExMjQ1MTEwOWU4YTFmODZlOTM4
|
14
|
+
MDNmOTU3YmQyMWNhMmE4NjQ3OTZjNDBhMmRiNWJmNzAxNWJhYjFjYzgxMThk
|
15
|
+
YTQ4YjgxNGI2NDA5MWZkNDE1MGQ4OTFhZmQxODZlYzVhNjU2MjM=
|
data/.travis.yml
CHANGED
data/lib/bwapi/client.rb
CHANGED
@@ -24,7 +24,9 @@ require 'bwapi/client/public'
|
|
24
24
|
require 'bwapi/client/query_validation'
|
25
25
|
require 'bwapi/client/sso'
|
26
26
|
require 'bwapi/client/test_search'
|
27
|
+
require 'bwapi/client/usage_summary'
|
27
28
|
require 'bwapi/client/user'
|
29
|
+
|
28
30
|
require 'faraday'
|
29
31
|
|
30
32
|
module BWAPI
|
@@ -56,6 +58,7 @@ module BWAPI
|
|
56
58
|
include BWAPI::Client::QueryValidation
|
57
59
|
include BWAPI::Client::SSO
|
58
60
|
include BWAPI::Client::TestSearch
|
61
|
+
include BWAPI::Client::UsageSummary
|
59
62
|
include BWAPI::Client::User
|
60
63
|
|
61
64
|
# Initializes Client
|
@@ -16,20 +16,6 @@ module BWAPI
|
|
16
16
|
def reseller_client_mention_usage_report(client_id, opts = {})
|
17
17
|
get "/admin/reseller/requestMentionUsageReport/#{client_id}", opts
|
18
18
|
end
|
19
|
-
|
20
|
-
# Requests reseller usage summaries
|
21
|
-
#
|
22
|
-
# TODO: Add parameters documentation
|
23
|
-
def reseller_usage_summary
|
24
|
-
get '/admin/reseller/usageSummary'
|
25
|
-
end
|
26
|
-
|
27
|
-
# Requests reseller usage summaries for a specific client
|
28
|
-
#
|
29
|
-
# TODO: Add parameters documentation
|
30
|
-
def reseller_client_usage_summary(client_id)
|
31
|
-
get "/admin/reseller/usageSummary/#{client_id}"
|
32
|
-
end
|
33
19
|
end
|
34
20
|
end
|
35
21
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
module BWAPI
|
2
|
+
class Client
|
3
|
+
# UsageSummary module for usageSummary endpoints
|
4
|
+
module UsageSummary
|
5
|
+
# Requests reseller usage summaries
|
6
|
+
#
|
7
|
+
# TODO: Add parameters documentation
|
8
|
+
def reseller_usage_summary(opts = {})
|
9
|
+
get 'reseller/usageSummary', opts
|
10
|
+
end
|
11
|
+
|
12
|
+
# Requests reseller usage summaries for a specific client
|
13
|
+
#
|
14
|
+
# TODO: Add parameters documentation
|
15
|
+
def reseller_client_usage_summary(client_id)
|
16
|
+
get "reseller/usageSummary/#{client_id}"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/bwapi/configuration.rb
CHANGED
@@ -2,7 +2,8 @@ module BWAPI
|
|
2
2
|
# Configuration module
|
3
3
|
module Configuration
|
4
4
|
attr_accessor :access_token, :access_token_expiry, :adapter, :api_endpoint, :client_id, :debug,
|
5
|
-
:grant_type, :logger, :
|
5
|
+
:grant_type, :logger, :open_timeout, :performance, :refresh_token, :timeout,
|
6
|
+
:user_agent, :username, :verify_ssl
|
6
7
|
|
7
8
|
attr_writer :client_secret, :password
|
8
9
|
|
@@ -20,9 +21,11 @@ module BWAPI
|
|
20
21
|
:debug,
|
21
22
|
:grant_type,
|
22
23
|
:logger,
|
24
|
+
:open_timeout,
|
23
25
|
:password,
|
24
26
|
:performance,
|
25
27
|
:refresh_token,
|
28
|
+
:timeout,
|
26
29
|
:user_agent,
|
27
30
|
:username,
|
28
31
|
:verify_ssl
|
data/lib/bwapi/connection.rb
CHANGED
@@ -25,6 +25,8 @@ module BWAPI
|
|
25
25
|
opts[:headers][:authorization] = "bearer #{@access_token}" if @access_token
|
26
26
|
opts[:builder] = middleware
|
27
27
|
opts[:ssl] = { verify: @verify_ssl }
|
28
|
+
opts[:request][:timeout] = @timeout
|
29
|
+
opts[:request][:open_timeout] = @open_timeout
|
28
30
|
opts[:url] = @api_endpoint
|
29
31
|
opts
|
30
32
|
end
|
data/lib/bwapi/default.rb
CHANGED
@@ -69,6 +69,10 @@ module BWAPI
|
|
69
69
|
nil
|
70
70
|
end
|
71
71
|
|
72
|
+
def open_timeout
|
73
|
+
ENV['OPEN_TIMEOUT'] || 30
|
74
|
+
end
|
75
|
+
|
72
76
|
def password
|
73
77
|
ENV['BWAPI_PASSWORD']
|
74
78
|
end
|
@@ -81,6 +85,10 @@ module BWAPI
|
|
81
85
|
ENV['BWAPI_REFRESH_TOKEN']
|
82
86
|
end
|
83
87
|
|
88
|
+
def timeout
|
89
|
+
ENV['TIMEOUT'] || 60
|
90
|
+
end
|
91
|
+
|
84
92
|
def user_agent
|
85
93
|
ENV['BWAPI_USER_AGENT'] || USER_AGENT
|
86
94
|
end
|
data/lib/bwapi/version.rb
CHANGED
@@ -240,9 +240,11 @@ describe BWAPI::Configuration do
|
|
240
240
|
:debug,
|
241
241
|
:grant_type,
|
242
242
|
:logger,
|
243
|
+
:open_timeout,
|
243
244
|
:password,
|
244
245
|
:performance,
|
245
246
|
:refresh_token,
|
247
|
+
:timeout,
|
246
248
|
:user_agent,
|
247
249
|
:username,
|
248
250
|
:verify_ssl
|
@@ -262,8 +264,10 @@ describe BWAPI::Configuration do
|
|
262
264
|
c.debug = true
|
263
265
|
c.grant_type = 'test-grant'
|
264
266
|
c.logger = Logger.new(STDOUT)
|
267
|
+
c.open_timeout = 60
|
265
268
|
c.password = 'password123'
|
266
269
|
c.refresh_token = '1234-5678-9010-1112'
|
270
|
+
c.timeout = 120
|
267
271
|
c.user_agent = 'Test User Agent'
|
268
272
|
c.username = 'testing@brandwatch.com'
|
269
273
|
c.verify_ssl = true
|
@@ -305,7 +309,11 @@ describe BWAPI::Configuration do
|
|
305
309
|
end
|
306
310
|
|
307
311
|
it 'should set the configured logger' do
|
308
|
-
expect(bwapi.logger).to be_an_instance_of
|
312
|
+
expect(bwapi.logger).to be_an_instance_of(Logger)
|
313
|
+
end
|
314
|
+
|
315
|
+
it 'should set the configured open timeout' do
|
316
|
+
expect(bwapi.open_timeout).to eql(60)
|
309
317
|
end
|
310
318
|
|
311
319
|
it 'should set the configured password' do
|
@@ -316,6 +324,10 @@ describe BWAPI::Configuration do
|
|
316
324
|
expect(bwapi.refresh_token).to eql('1234-5678-9010-1112')
|
317
325
|
end
|
318
326
|
|
327
|
+
it 'should set the configured timeout' do
|
328
|
+
expect(bwapi.timeout).to eql(120)
|
329
|
+
end
|
330
|
+
|
319
331
|
it 'should set the configured user agent' do
|
320
332
|
expect(bwapi.user_agent).to eql('Test User Agent')
|
321
333
|
end
|
@@ -372,6 +384,10 @@ describe BWAPI::Configuration do
|
|
372
384
|
expect(bwapi.logger).to eql(nil)
|
373
385
|
end
|
374
386
|
|
387
|
+
it 'should reset the open timeout' do
|
388
|
+
expect(bwapi.open_timeout).to eql(30)
|
389
|
+
end
|
390
|
+
|
375
391
|
it 'should reset the password value' do
|
376
392
|
expect(bwapi.instance_variable_get(:@password)).to eql(nil)
|
377
393
|
end
|
@@ -384,8 +400,12 @@ describe BWAPI::Configuration do
|
|
384
400
|
expect(bwapi.refresh_token).to eql(nil)
|
385
401
|
end
|
386
402
|
|
403
|
+
it 'should reset the timeout' do
|
404
|
+
expect(bwapi.timeout).to eql(60)
|
405
|
+
end
|
406
|
+
|
387
407
|
it 'should reset the user_agent value' do
|
388
|
-
expect(bwapi.user_agent).to eql('BWAPI Ruby Gem 12.
|
408
|
+
expect(bwapi.user_agent).to eql('BWAPI Ruby Gem 12.1.0')
|
389
409
|
end
|
390
410
|
|
391
411
|
it 'should reset the username value' do
|
@@ -440,6 +460,10 @@ describe BWAPI::Configuration do
|
|
440
460
|
expect(bwapi.logger).to eql(nil)
|
441
461
|
end
|
442
462
|
|
463
|
+
it 'should reset the open timeout' do
|
464
|
+
expect(bwapi.open_timeout).to eql(nil)
|
465
|
+
end
|
466
|
+
|
443
467
|
it 'should reset the password value' do
|
444
468
|
expect(bwapi.instance_variable_get(:@password)).to eql(nil)
|
445
469
|
end
|
@@ -452,6 +476,10 @@ describe BWAPI::Configuration do
|
|
452
476
|
expect(bwapi.refresh_token).to eql(nil)
|
453
477
|
end
|
454
478
|
|
479
|
+
it 'should reset the timeout' do
|
480
|
+
expect(bwapi.open_timeout).to eql(nil)
|
481
|
+
end
|
482
|
+
|
455
483
|
it 'should reset the user_agent value' do
|
456
484
|
expect(bwapi.user_agent).to eql(nil)
|
457
485
|
end
|
@@ -478,7 +506,7 @@ describe BWAPI::Configuration do
|
|
478
506
|
client_secret: nil,
|
479
507
|
connection_options: {
|
480
508
|
headers: {
|
481
|
-
user_agent: 'BWAPI Ruby Gem 12.
|
509
|
+
user_agent: 'BWAPI Ruby Gem 12.1.0'
|
482
510
|
},
|
483
511
|
request: {
|
484
512
|
params_encoder: Faraday::FlatParamsEncoder
|
@@ -487,10 +515,12 @@ describe BWAPI::Configuration do
|
|
487
515
|
debug: false,
|
488
516
|
grant_type: 'api-password',
|
489
517
|
logger: nil,
|
518
|
+
open_timeout: 30,
|
490
519
|
password: nil,
|
491
520
|
performance: {},
|
492
521
|
refresh_token: nil,
|
493
|
-
|
522
|
+
timeout: 60,
|
523
|
+
user_agent: 'BWAPI Ruby Gem 12.1.0',
|
494
524
|
username: nil,
|
495
525
|
verify_ssl: false
|
496
526
|
)
|
data/spec/bwapi/default_spec.rb
CHANGED
@@ -34,7 +34,7 @@ describe BWAPI::Default do
|
|
34
34
|
client_secret: nil,
|
35
35
|
connection_options: {
|
36
36
|
headers: {
|
37
|
-
user_agent: 'BWAPI Ruby Gem 12.
|
37
|
+
user_agent: 'BWAPI Ruby Gem 12.1.0'
|
38
38
|
},
|
39
39
|
request: {
|
40
40
|
params_encoder: Faraday::FlatParamsEncoder
|
@@ -43,10 +43,12 @@ describe BWAPI::Default do
|
|
43
43
|
debug: false,
|
44
44
|
grant_type: 'api-password',
|
45
45
|
logger: nil,
|
46
|
+
open_timeout: 30,
|
46
47
|
password: nil,
|
47
48
|
performance: {},
|
48
49
|
refresh_token: nil,
|
49
|
-
|
50
|
+
timeout: 60,
|
51
|
+
user_agent: 'BWAPI Ruby Gem 12.1.0',
|
50
52
|
username: nil,
|
51
53
|
verify_ssl: false
|
52
54
|
)
|
@@ -128,7 +130,7 @@ describe BWAPI::Default do
|
|
128
130
|
it 'should return the default hash values' do
|
129
131
|
expect(BWAPI::Default.connection_options).to eql(
|
130
132
|
headers: {
|
131
|
-
user_agent: 'BWAPI Ruby Gem 12.
|
133
|
+
user_agent: 'BWAPI Ruby Gem 12.1.0'
|
132
134
|
},
|
133
135
|
request: {
|
134
136
|
params_encoder: Faraday::FlatParamsEncoder
|
metadata
CHANGED
@@ -1,125 +1,125 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bwapi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 12.0.
|
4
|
+
version: 12.1.0.pre.646
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan Chrisp
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-11-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '3.0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - ~>
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '3.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rubocop
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0.24'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - ~>
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0.24'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: allotment
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ~>
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '1.1'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ~>
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '1.1'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: faraday
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ~>
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0.9'
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - ~>
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0.9'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: faraday_middleware
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ~>
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0.9'
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ~>
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0.9'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: faraday_middleware-parse_csv
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ~>
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0.1'
|
90
90
|
type: :runtime
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ~>
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0.1'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: faraday_middleware-parse_oj
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - ~>
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0.3'
|
104
104
|
type: :runtime
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - ~>
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0.3'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: oj
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- -
|
115
|
+
- - ~>
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '2.11'
|
118
118
|
type: :runtime
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
|
-
- -
|
122
|
+
- - ~>
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '2.11'
|
125
125
|
description: A Ruby wrapper for the Brandwatch API
|
@@ -129,10 +129,10 @@ executables:
|
|
129
129
|
extensions: []
|
130
130
|
extra_rdoc_files: []
|
131
131
|
files:
|
132
|
-
-
|
133
|
-
-
|
134
|
-
-
|
135
|
-
-
|
132
|
+
- .editorconfig
|
133
|
+
- .gitignore
|
134
|
+
- .rubocop.yml
|
135
|
+
- .travis.yml
|
136
136
|
- CHANGELOG.md
|
137
137
|
- CONTRIBUTING.md
|
138
138
|
- Gemfile
|
@@ -269,6 +269,7 @@ files:
|
|
269
269
|
- lib/bwapi/client/query_validation.rb
|
270
270
|
- lib/bwapi/client/sso.rb
|
271
271
|
- lib/bwapi/client/test_search.rb
|
272
|
+
- lib/bwapi/client/usage_summary.rb
|
272
273
|
- lib/bwapi/client/user.rb
|
273
274
|
- lib/bwapi/client/user/facebook.rb
|
274
275
|
- lib/bwapi/client/user/instagram_credentials.rb
|
@@ -300,17 +301,17 @@ require_paths:
|
|
300
301
|
- lib
|
301
302
|
required_ruby_version: !ruby/object:Gem::Requirement
|
302
303
|
requirements:
|
303
|
-
- -
|
304
|
+
- - ! '>='
|
304
305
|
- !ruby/object:Gem::Version
|
305
306
|
version: 1.9.3
|
306
307
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
307
308
|
requirements:
|
308
|
-
- -
|
309
|
+
- - ! '>'
|
309
310
|
- !ruby/object:Gem::Version
|
310
|
-
version:
|
311
|
+
version: 1.3.1
|
311
312
|
requirements: []
|
312
313
|
rubyforge_project:
|
313
|
-
rubygems_version: 2.4.
|
314
|
+
rubygems_version: 2.4.5
|
314
315
|
signing_key:
|
315
316
|
specification_version: 4
|
316
317
|
summary: Brandwatch API Wrapper
|
@@ -320,4 +321,3 @@ test_files:
|
|
320
321
|
- spec/bwapi/default_spec.rb
|
321
322
|
- spec/bwapi_spec.rb
|
322
323
|
- spec/helper.rb
|
323
|
-
has_rdoc:
|