bwapi 6.5.0.pre.256 → 7.0.0.pre.271
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/.editorconfig +11 -0
- data/.rubocop.yml +17 -0
- data/.travis.yml +7 -3
- data/bin/bwapi +2 -1
- data/bwapi.gemspec +13 -10
- data/lib/bwapi.rb +6 -6
- data/lib/bwapi/authentication.rb +9 -17
- data/lib/bwapi/client.rb +5 -4
- data/lib/bwapi/client/admin.rb +6 -6
- data/lib/bwapi/client/admin/become.rb +4 -4
- data/lib/bwapi/client/admin/search.rb +9 -12
- data/lib/bwapi/client/admin/sub_clients.rb +8 -13
- data/lib/bwapi/client/admin/users.rb +7 -7
- data/lib/bwapi/client/admin/users/sharing.rb +5 -7
- data/lib/bwapi/client/brandwatch.rb +4 -4
- data/lib/bwapi/client/brandwatch/become.rb +4 -4
- data/lib/bwapi/client/brandwatch/client_modules.rb +5 -6
- data/lib/bwapi/client/client.rb +5 -6
- data/lib/bwapi/client/command_center.rb +3 -3
- data/lib/bwapi/client/command_center/client.rb +4 -4
- data/lib/bwapi/client/command_center/displays.rb +9 -9
- data/lib/bwapi/client/command_center/displays/events.rb +8 -8
- data/lib/bwapi/client/command_center/displays/messages.rb +7 -8
- data/lib/bwapi/client/command_center/displays/scenes.rb +9 -9
- data/lib/bwapi/client/command_center/displays/screens.rb +9 -9
- data/lib/bwapi/client/command_center/displays/users.rb +7 -8
- data/lib/bwapi/client/command_center/displays/users/access.rb +4 -5
- data/lib/bwapi/client/command_center/scene_types.rb +6 -6
- data/lib/bwapi/client/command_center/themes.rb +4 -4
- data/lib/bwapi/client/command_center/users.rb +6 -6
- data/lib/bwapi/client/command_center/users/access.rb +5 -5
- data/lib/bwapi/client/error_codes.rb +4 -4
- data/lib/bwapi/client/filters.rb +4 -4
- data/lib/bwapi/client/languages.rb +3 -3
- data/lib/bwapi/client/location.rb +5 -5
- data/lib/bwapi/client/logout.rb +12 -14
- data/lib/bwapi/client/me.rb +3 -3
- data/lib/bwapi/client/metrics.rb +3 -3
- data/lib/bwapi/client/oauth.rb +8 -8
- data/lib/bwapi/client/ping.rb +8 -8
- data/lib/bwapi/client/projects.rb +10 -10
- data/lib/bwapi/client/projects/bulkactions.rb +4 -4
- data/lib/bwapi/client/projects/bulkactions/author.rb +4 -3
- data/lib/bwapi/client/projects/bulkactions/mentions.rb +4 -3
- data/lib/bwapi/client/projects/categories.rb +6 -20
- data/lib/bwapi/client/projects/data.rb +4 -5
- data/lib/bwapi/client/projects/data/mentions.rb +7 -7
- data/lib/bwapi/client/projects/data/volume.rb +11 -11
- data/lib/bwapi/client/projects/data_download.rb +6 -7
- data/lib/bwapi/client/projects/demographics.rb +3 -4
- data/lib/bwapi/client/projects/facebook_queries.rb +8 -9
- data/lib/bwapi/client/projects/group.rb +2 -2
- data/lib/bwapi/client/projects/group/author_group.rb +8 -7
- data/lib/bwapi/client/projects/group/location_group.rb +7 -7
- data/lib/bwapi/client/projects/group/site_group.rb +7 -7
- data/lib/bwapi/client/projects/queries.rb +9 -10
- data/lib/bwapi/client/projects/queries/backfill.rb +6 -8
- data/lib/bwapi/client/projects/queries/date_range.rb +9 -9
- data/lib/bwapi/client/projects/queries/mentions.rb +5 -8
- data/lib/bwapi/client/projects/query_groups.rb +7 -9
- data/lib/bwapi/client/projects/rules.rb +7 -9
- data/lib/bwapi/client/projects/rules/backfill.rb +4 -4
- data/lib/bwapi/client/projects/rules/copy.rb +4 -4
- data/lib/bwapi/client/projects/sharing.rb +8 -9
- data/lib/bwapi/client/projects/signals.rb +5 -5
- data/lib/bwapi/client/projects/stream_dashboards.rb +10 -10
- data/lib/bwapi/client/projects/stream_dashboards/streams.rb +6 -7
- data/lib/bwapi/client/projects/summary.rb +5 -6
- data/lib/bwapi/client/projects/tags.rb +8 -9
- data/lib/bwapi/client/projects/twitter_queries.rb +7 -8
- data/lib/bwapi/client/projects/users.rb +4 -4
- data/lib/bwapi/client/projects/workflow.rb +4 -4
- data/lib/bwapi/client/query_validation.rb +7 -7
- data/lib/bwapi/client/sso.rb +4 -4
- data/lib/bwapi/client/test_search.rb +9 -8
- data/lib/bwapi/client/user.rb +6 -6
- data/lib/bwapi/client/user/notifications.rb +8 -8
- data/lib/bwapi/configuration.rb +6 -6
- data/lib/bwapi/connection.rb +10 -19
- data/lib/bwapi/error.rb +43 -36
- data/lib/bwapi/request.rb +24 -27
- data/lib/bwapi/version.rb +5 -2
- data/lib/faraday/response/brandwatch_error.rb +21 -22
- data/spec/bwapi/authentication_spec.rb +7 -7
- data/spec/bwapi/client_spec.rb +17 -17
- data/spec/bwapi_spec.rb +3 -3
- data/spec/fixtures/.netrc +1 -1
- data/spec/helper.rb +4 -2
- metadata +61 -4
- data/lib/faraday/utils/utils.rb +0 -26
checksums.yaml
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
---
|
|
2
2
|
!binary "U0hBMQ==":
|
|
3
3
|
metadata.gz: !binary |-
|
|
4
|
-
|
|
4
|
+
ZDU2NzRiMjIwYjU0MjQwN2VlMGUzNzZiZmMwNTA5NjMxODJlZTA4Mg==
|
|
5
5
|
data.tar.gz: !binary |-
|
|
6
|
-
|
|
6
|
+
YTVlYTNlZjM1NTA2NzA4MmU0YWQwOWFlYjM5NjRlNjQ0Nzc2YzNmYw==
|
|
7
7
|
SHA512:
|
|
8
8
|
metadata.gz: !binary |-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
NDIxNWIwNTNmZmVkMzdmN2FkNDI0MGM5N2I2NzAwZmY4NjE5NThiYTU4OWVh
|
|
10
|
+
YWI5OTM3NTg3NzRlZDI1MTc1ZTY4MjczMWFhZDI4YjUwZDY3YzQxNGRmMjNj
|
|
11
|
+
ODJlYjlmY2Y4ZmI2YmI3Y2FiMDNjYzI5Njc0MDIwZTlmZjQxMzM=
|
|
12
12
|
data.tar.gz: !binary |-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
MmU4MzViODAxNDliM2M4OTQ1YmNmZjViMDc2MzNkN2I1YTE4ZDMwZTFmZjAx
|
|
14
|
+
NjVjZmRhZTliNmU1Y2Y3MmUzMGJjYmFjYjMwYmZlMTYwZDNhOGZkMzA4ZTA4
|
|
15
|
+
NjUxYzRlYzliNmIwOTYzYTI5MjRiMjEyYjFjYjJkOGY4YzdjNzQ=
|
data/.editorconfig
ADDED
data/.rubocop.yml
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# See full list of defaults here: https://github.com/bbatsov/rubocop/blob/master/config/default.yml
|
|
2
|
+
# To see all cops used see here: https://github.com/bbatsov/rubocop/blob/master/config/enabled.yml
|
|
3
|
+
|
|
4
|
+
LineLength:
|
|
5
|
+
Max: 150
|
|
6
|
+
|
|
7
|
+
MethodLength:
|
|
8
|
+
Max: 30
|
|
9
|
+
|
|
10
|
+
CyclomaticComplexity:
|
|
11
|
+
Max: 15
|
|
12
|
+
|
|
13
|
+
AccessorMethodName:
|
|
14
|
+
Enabled: false
|
|
15
|
+
|
|
16
|
+
RaiseArgs:
|
|
17
|
+
Enabled: false
|
data/.travis.yml
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
language: ruby
|
|
2
|
+
cache: bundler
|
|
2
3
|
rvm:
|
|
4
|
+
- 2.1.0
|
|
3
5
|
- 2.0.0
|
|
4
6
|
- 1.9.3
|
|
5
7
|
- 1.9.2
|
|
6
8
|
|
|
7
9
|
before_script:
|
|
8
|
-
- chmod 600 spec/fixtures/.netrc
|
|
10
|
+
- chmod 600 spec/fixtures/.netrc
|
|
9
11
|
|
|
10
|
-
script:
|
|
12
|
+
script:
|
|
13
|
+
- bundle exec rubocop
|
|
14
|
+
- bundle exec rspec spec
|
|
11
15
|
|
|
12
16
|
deploy:
|
|
13
17
|
provider: rubygems
|
|
@@ -15,4 +19,4 @@ deploy:
|
|
|
15
19
|
secure: g7xKyeiMs2o1HLokzOWCiLKxmTaEmuQDB0he9kxFhjqMLbRQHu1pVL0uE2bD0K/zq8Ebb+OPchVmej/6s5Be97AOK5d1wGdBAhXISwlxPoXxLJ6zU5DF1vjF3YCZK197z81ATcGcocsD2eYXZ4NzJcI+FW3kzO6QQhfHfUUeHvM=
|
|
16
20
|
gem: bwapi
|
|
17
21
|
on:
|
|
18
|
-
repo: jonathanchrisp/bwapi
|
|
22
|
+
repo: jonathanchrisp/bwapi
|
data/bin/bwapi
CHANGED
data/bwapi.gemspec
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
|
|
3
|
+
require File.dirname(__FILE__) + '/lib/bwapi/version'
|
|
2
4
|
|
|
3
5
|
Gem::Specification.new do |s|
|
|
4
6
|
s.name = 'bwapi'
|
|
@@ -11,19 +13,20 @@ Gem::Specification.new do |s|
|
|
|
11
13
|
s.email = 'jonathan@brandwatch.com'
|
|
12
14
|
s.license = 'MIT'
|
|
13
15
|
s.homepage = 'https://github.com/jonathanchrisp/bwapi'
|
|
14
|
-
s.required_ruby_version =
|
|
16
|
+
s.required_ruby_version = '>= 1.9.2'
|
|
15
17
|
|
|
16
|
-
s.add_development_dependency 'rspec', '~> 2.14.1'
|
|
18
|
+
s.add_development_dependency 'rspec', '~> 2.14.1', '>= 2.14.1'
|
|
19
|
+
s.add_development_dependency 'rubocop', '~> 0.21.0', '>= 0.21.0'
|
|
17
20
|
|
|
18
21
|
s.add_runtime_dependency 'colored', '~> 1.2'
|
|
19
|
-
s.add_runtime_dependency 'faraday', '~> 0.
|
|
20
|
-
s.add_runtime_dependency 'faraday_middleware', '~> 0.9.0'
|
|
21
|
-
s.add_runtime_dependency 'hashie', '~> 2.0.5'
|
|
22
|
-
s.add_runtime_dependency 'multi_json', '~> 1.9.0'
|
|
23
|
-
s.add_runtime_dependency 'netrc', '~> 0.7.7'
|
|
22
|
+
s.add_runtime_dependency 'faraday', '~> 0.9.0', '>= 0.9.0'
|
|
23
|
+
s.add_runtime_dependency 'faraday_middleware', '~> 0.9.0', '>= 0.9.0'
|
|
24
|
+
s.add_runtime_dependency 'hashie', '~> 2.0.5', '>= 2.0.5'
|
|
25
|
+
s.add_runtime_dependency 'multi_json', '~> 1.9.0', '>= 1.9.0'
|
|
26
|
+
s.add_runtime_dependency 'netrc', '~> 0.7.7', '>= 0.7.7'
|
|
24
27
|
|
|
25
28
|
s.files = `git ls-files`.split("\n")
|
|
26
|
-
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
|
29
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
|
27
30
|
s.test_files = `git ls-files -- spec/*`.split("\n")
|
|
28
31
|
s.require_paths = ['lib']
|
|
29
|
-
end
|
|
32
|
+
end
|
data/lib/bwapi.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
|
|
1
3
|
require 'bwapi/version'
|
|
2
4
|
require 'bwapi/configuration'
|
|
3
5
|
require 'bwapi/error'
|
|
@@ -7,23 +9,21 @@ require 'bwapi/client'
|
|
|
7
9
|
module BWAPI
|
|
8
10
|
extend Configuration
|
|
9
11
|
class << self
|
|
10
|
-
|
|
11
12
|
# Alias for BWAPI::Client.new
|
|
12
13
|
#
|
|
13
14
|
# @return [BWAPI::Client]
|
|
14
|
-
def new
|
|
15
|
+
def new(opts = {})
|
|
15
16
|
BWAPI::Client.new opts
|
|
16
17
|
end
|
|
17
18
|
|
|
18
19
|
# Delegate to BWAPI::Client.new
|
|
19
|
-
def method_missing
|
|
20
|
+
def method_missing(method, *args, &block)
|
|
20
21
|
return super unless new.respond_to? method
|
|
21
22
|
new.send method, *args, &block
|
|
22
23
|
end
|
|
23
24
|
|
|
24
|
-
def respond_to?
|
|
25
|
+
def respond_to?(method, include_private = false)
|
|
25
26
|
new.respond_to?(method, include_private) || super(method, include_private)
|
|
26
27
|
end
|
|
27
|
-
|
|
28
28
|
end
|
|
29
|
-
end
|
|
29
|
+
end
|
data/lib/bwapi/authentication.rb
CHANGED
|
@@ -1,42 +1,35 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
|
|
1
3
|
require 'colored'
|
|
2
4
|
|
|
3
5
|
module BWAPI
|
|
4
6
|
# Authentication module helper methods
|
|
5
7
|
module Authentication
|
|
6
|
-
|
|
7
8
|
# Check if user is authenicated
|
|
8
9
|
#
|
|
9
10
|
# @return [Boolean] Authenticated status
|
|
10
11
|
def authenticated?
|
|
11
|
-
|
|
12
|
+
access_token ? true : false
|
|
12
13
|
end
|
|
13
14
|
|
|
14
15
|
# Check if user is a brandwatch-application-client type
|
|
15
16
|
#
|
|
16
17
|
# @return [Boolean] Application client status
|
|
17
18
|
def application_client?
|
|
18
|
-
|
|
19
|
-
true
|
|
20
|
-
else
|
|
21
|
-
false
|
|
22
|
-
end
|
|
19
|
+
client_id == 'brandwatch-application-client' ? true : false
|
|
23
20
|
end
|
|
24
21
|
|
|
25
22
|
# Check if user is a brandwatch-api-client type
|
|
26
23
|
#
|
|
27
24
|
# @return [Boolean] Application client status
|
|
28
25
|
def api_client?
|
|
29
|
-
|
|
30
|
-
true
|
|
31
|
-
else
|
|
32
|
-
false
|
|
33
|
-
end
|
|
26
|
+
client_id == 'brandwatch-api-client' ? true : false
|
|
34
27
|
end
|
|
35
28
|
|
|
36
29
|
# Set username and password via netrc
|
|
37
30
|
#
|
|
38
31
|
# @param netrc [Boolean] Netrc status
|
|
39
|
-
def netrc_credentials
|
|
32
|
+
def netrc_credentials(netrc = false)
|
|
40
33
|
return unless netrc
|
|
41
34
|
|
|
42
35
|
require 'netrc'
|
|
@@ -45,12 +38,11 @@ module BWAPI
|
|
|
45
38
|
# Get credentials using host
|
|
46
39
|
netrc_host = URI.parse(api_endpoint).host
|
|
47
40
|
creds = file[netrc_host]
|
|
48
|
-
|
|
41
|
+
fail 'You are missing your .netrc file or the host provided has no credentials!'.red.underline if creds.nil?
|
|
49
42
|
self.username = creds.shift
|
|
50
43
|
self.password = creds.shift
|
|
51
44
|
rescue LoadError
|
|
52
|
-
raise
|
|
45
|
+
raise 'Please install netrc gem for .netrc support'.red.underline
|
|
53
46
|
end
|
|
54
|
-
|
|
55
47
|
end
|
|
56
|
-
end
|
|
48
|
+
end
|
data/lib/bwapi/client.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
|
|
1
3
|
require 'bwapi/authentication'
|
|
2
4
|
require 'bwapi/connection'
|
|
3
5
|
require 'bwapi/request'
|
|
@@ -24,10 +26,9 @@ require 'bwapi/client/user'
|
|
|
24
26
|
module BWAPI
|
|
25
27
|
# Client class to create BWAPI instances
|
|
26
28
|
class Client
|
|
29
|
+
attr_accessor(*Configuration::OPTION_KEYS)
|
|
27
30
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
def initialize opts={}
|
|
31
|
+
def initialize(opts = {})
|
|
31
32
|
opts = BWAPI.options.merge opts
|
|
32
33
|
Configuration::OPTION_KEYS.each do |k|
|
|
33
34
|
send "#{k}=", opts[k]
|
|
@@ -59,4 +60,4 @@ module BWAPI
|
|
|
59
60
|
include BWAPI::Client::TestSearch
|
|
60
61
|
include BWAPI::Client::User
|
|
61
62
|
end
|
|
62
|
-
end
|
|
63
|
+
end
|
data/lib/bwapi/client/admin.rb
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
|
|
1
3
|
require 'bwapi/client/admin/become'
|
|
2
4
|
require 'bwapi/client/admin/search'
|
|
3
5
|
require 'bwapi/client/admin/sub_clients'
|
|
@@ -7,7 +9,6 @@ module BWAPI
|
|
|
7
9
|
class Client
|
|
8
10
|
# Admin module for admin endpoints
|
|
9
11
|
module Admin
|
|
10
|
-
|
|
11
12
|
# Get the active queries irrespective of project
|
|
12
13
|
#
|
|
13
14
|
# @param opts [Hash] options hash of parameters
|
|
@@ -15,22 +16,21 @@ module BWAPI
|
|
|
15
16
|
# @option opts [Integer] pageSize Results per page of results
|
|
16
17
|
# @option opts [Integer] sortBy Filter to sort queries by
|
|
17
18
|
# @return [Hashie::Mash] All active queries
|
|
18
|
-
def active_queries
|
|
19
|
-
get
|
|
19
|
+
def active_queries(opts = {})
|
|
20
|
+
get 'admin/activequeries', opts
|
|
20
21
|
end
|
|
21
22
|
|
|
22
23
|
# Get the project report of sharing details
|
|
23
24
|
#
|
|
24
25
|
# @return [Hashie::Mash] Project sharing report
|
|
25
26
|
def sharing_report
|
|
26
|
-
get
|
|
27
|
+
get 'admin/sharing-report'
|
|
27
28
|
end
|
|
28
29
|
|
|
29
30
|
include BWAPI::Client::Admin::Clients::Become
|
|
30
31
|
include BWAPI::Client::Admin::Clients::SubClients
|
|
31
32
|
include BWAPI::Client::Admin::Clients::Search
|
|
32
33
|
include BWAPI::Client::Admin::Clients::Users
|
|
33
|
-
|
|
34
34
|
end
|
|
35
35
|
end
|
|
36
|
-
end
|
|
36
|
+
end
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
|
|
1
3
|
module BWAPI
|
|
2
4
|
class Client
|
|
3
5
|
module Admin
|
|
4
6
|
module Clients
|
|
5
7
|
# Become module for admin/become endpoint
|
|
6
8
|
module Become
|
|
7
|
-
|
|
8
9
|
# Become user
|
|
9
10
|
#
|
|
10
11
|
# @note must be a client admin user
|
|
11
12
|
#
|
|
12
13
|
# @param user_id [Integer] The user id
|
|
13
14
|
# @return [Hashie::Mash] User credentials
|
|
14
|
-
def admin_become
|
|
15
|
+
def admin_become(user_id)
|
|
15
16
|
get "admin/become/#{user_id}"
|
|
16
17
|
end
|
|
17
|
-
|
|
18
18
|
end
|
|
19
19
|
end
|
|
20
20
|
end
|
|
21
21
|
end
|
|
22
|
-
end
|
|
22
|
+
end
|
|
@@ -1,42 +1,39 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
|
|
1
3
|
module BWAPI
|
|
2
4
|
class Client
|
|
3
5
|
module Admin
|
|
4
6
|
module Clients
|
|
5
7
|
# Search module for admin/search endpoints
|
|
6
8
|
module Search
|
|
7
|
-
|
|
8
9
|
# Get a list of queries
|
|
9
10
|
#
|
|
10
11
|
# @param opts [Hash] options hash of parameters
|
|
11
12
|
# @option opts [Integer] text Text expression
|
|
12
13
|
# @return [Hashie::Mash] List of queries
|
|
13
|
-
def search_query_text
|
|
14
|
-
get
|
|
14
|
+
def search_query_text(opts = {})
|
|
15
|
+
get 'admin/search/querytext', opts
|
|
15
16
|
end
|
|
16
|
-
alias :query_text :search_query_text
|
|
17
17
|
|
|
18
18
|
# Get a list of query names
|
|
19
19
|
#
|
|
20
20
|
# @param opts [Hash] options hash of parameters
|
|
21
21
|
# @option opts [Integer] text Text expression
|
|
22
22
|
# @return [Hashie::Mash] List of query names
|
|
23
|
-
def search_query_name
|
|
24
|
-
get
|
|
23
|
+
def search_query_name(opts = {})
|
|
24
|
+
get 'admin/search/queryname', opts
|
|
25
25
|
end
|
|
26
|
-
alias :query_name :search_query_name
|
|
27
26
|
|
|
28
27
|
# Get a list of rules
|
|
29
28
|
#
|
|
30
29
|
# @param opts [Hash] options hash of parameters
|
|
31
30
|
# @option opts [Integer] text Text expression
|
|
32
31
|
# @return [Hashie::Mash] List of rules
|
|
33
|
-
def search_rule_text
|
|
34
|
-
get
|
|
32
|
+
def search_rule_text(opts = {})
|
|
33
|
+
get 'admin/search/ruletext', opts
|
|
35
34
|
end
|
|
36
|
-
alias :rule_text :search_rule_text
|
|
37
|
-
|
|
38
35
|
end
|
|
39
36
|
end
|
|
40
37
|
end
|
|
41
38
|
end
|
|
42
|
-
end
|
|
39
|
+
end
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
|
|
1
3
|
module BWAPI
|
|
2
4
|
class Client
|
|
3
5
|
module Admin
|
|
4
6
|
module Clients
|
|
5
7
|
# Subclients module for admin/subclient endpoints
|
|
6
8
|
module SubClients
|
|
7
|
-
|
|
8
9
|
# Get all sub clients
|
|
9
10
|
#
|
|
10
11
|
# @param client_id [Integer] Id of the client
|
|
@@ -12,20 +13,18 @@ module BWAPI
|
|
|
12
13
|
# @option opts [Integer] page Page of projects to retrieve
|
|
13
14
|
# @option opts [Integer] pageSize Results per page of results
|
|
14
15
|
# @return [Hashie::Mash] All sub clients for client
|
|
15
|
-
def client_sub_clients
|
|
16
|
+
def client_sub_clients(client_id, opts = {})
|
|
16
17
|
get "admin/clients/#{client_id}/subclients", opts
|
|
17
18
|
end
|
|
18
|
-
alias :sub_clients :client_sub_clients
|
|
19
19
|
|
|
20
20
|
# Get specific sub client of client
|
|
21
21
|
#
|
|
22
22
|
# @param client_id [Integer] Id of the client
|
|
23
23
|
# @param sub_client_id [Integer] Id of the sub client
|
|
24
24
|
# @return [Hashie::Mash] Specific sub client for client
|
|
25
|
-
def get_client_sub_client
|
|
25
|
+
def get_client_sub_client(client_id, sub_client_id)
|
|
26
26
|
get "admin/clients/#{client_id}/subclients/#{sub_client_id}"
|
|
27
27
|
end
|
|
28
|
-
alias :sub_client :get_client_sub_client
|
|
29
28
|
|
|
30
29
|
# Create new subclient
|
|
31
30
|
#
|
|
@@ -58,10 +57,9 @@ module BWAPI
|
|
|
58
57
|
# @option opts [Integer] maximumSubscribedBrands The maximum subscribed brands for the client
|
|
59
58
|
# @option opts [String] contactMobile The mobile number for the client
|
|
60
59
|
# @return [Hashie::Mash] New sub client
|
|
61
|
-
def create_client_sub_client
|
|
60
|
+
def create_client_sub_client(client_id, opts = {})
|
|
62
61
|
post "admin/clients/#{client_id}/subclients", opts
|
|
63
62
|
end
|
|
64
|
-
alias :create_sub_client :create_client_sub_client
|
|
65
63
|
|
|
66
64
|
# Update new subclient
|
|
67
65
|
#
|
|
@@ -95,23 +93,20 @@ module BWAPI
|
|
|
95
93
|
# @option opts [Integer] maximumSubscribedBrands The maximum subscribed brands for the client
|
|
96
94
|
# @option opts [String] contactMobile The mobile number for the client
|
|
97
95
|
# @return [Hashie::Mash] Edited sub client
|
|
98
|
-
def update_client_sub_client
|
|
96
|
+
def update_client_sub_client(client_id, sub_client_id, opts = {})
|
|
99
97
|
put "admin/clients/#{client_id}/subclients/#{sub_client_id}", opts
|
|
100
98
|
end
|
|
101
|
-
alias :update_sub_client :update_client_sub_client
|
|
102
99
|
|
|
103
100
|
# Delete specific sub client of client
|
|
104
101
|
#
|
|
105
102
|
# @param client_id [Integer] Id of the client
|
|
106
103
|
# @param sub_client_id [Integer] Id of the sub client
|
|
107
104
|
# @return [Hashie::Mash] Specific sub client for client
|
|
108
|
-
def delete_client_sub_client
|
|
105
|
+
def delete_client_sub_client(client_id, sub_client_id)
|
|
109
106
|
delete "admin/clients/#{client_id}/subclients/#{sub_client_id}"
|
|
110
107
|
end
|
|
111
|
-
alias :delete_sub_client :delete_client_sub_client
|
|
112
|
-
|
|
113
108
|
end
|
|
114
109
|
end
|
|
115
110
|
end
|
|
116
111
|
end
|
|
117
|
-
end
|
|
112
|
+
end
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
# encoding: utf-8
|
|
2
|
+
|
|
1
3
|
require 'bwapi/client/admin/users/sharing'
|
|
2
4
|
|
|
3
5
|
module BWAPI
|
|
@@ -6,7 +8,6 @@ module BWAPI
|
|
|
6
8
|
module Clients
|
|
7
9
|
# Users module for admin/users endpoints
|
|
8
10
|
module Users
|
|
9
|
-
|
|
10
11
|
# Get all users for client
|
|
11
12
|
#
|
|
12
13
|
# @param client_id [Integer] Id of the client
|
|
@@ -14,7 +15,7 @@ module BWAPI
|
|
|
14
15
|
# @option opts [Integer] page Page of projects to retrieve
|
|
15
16
|
# @option opts [Integer] pageSize Results per page of results
|
|
16
17
|
# @return [Hashie::Mash] All client users
|
|
17
|
-
def client_users
|
|
18
|
+
def client_users(client_id, opts = {})
|
|
18
19
|
get "admin/clients/#{client_id}/users", opts
|
|
19
20
|
end
|
|
20
21
|
|
|
@@ -23,7 +24,7 @@ module BWAPI
|
|
|
23
24
|
# @param client_id [Integer] Id of the client
|
|
24
25
|
# @param user_id [Integer] Id of the user
|
|
25
26
|
# @return [Hashie::Mash] Specific client user
|
|
26
|
-
def get_client_user
|
|
27
|
+
def get_client_user(client_id, user_id)
|
|
27
28
|
get "admin/clients/#{client_id}/users/#{user_id}"
|
|
28
29
|
end
|
|
29
30
|
|
|
@@ -50,7 +51,7 @@ module BWAPI
|
|
|
50
51
|
# @option opts [String] mobile The users mobile number
|
|
51
52
|
# @option opts [Date] creationDate Date the user was created on
|
|
52
53
|
# @return [Hashie::Mash] New user
|
|
53
|
-
def create_client_user
|
|
54
|
+
def create_client_user(client_id, opts = {})
|
|
54
55
|
post "admin/clients/#{client_id}/users", opts
|
|
55
56
|
end
|
|
56
57
|
|
|
@@ -78,14 +79,13 @@ module BWAPI
|
|
|
78
79
|
# @option opts [String] mobile The users mobile number
|
|
79
80
|
# @option opts [Date] creationDate Date the user was created on
|
|
80
81
|
# @return [Hashie::Mash] New user
|
|
81
|
-
def update_client_user
|
|
82
|
+
def update_client_user(client_id, user_id, opts = {})
|
|
82
83
|
put "admin/clients/#{client_id}/users/#{user_id}", opts
|
|
83
84
|
end
|
|
84
85
|
|
|
85
86
|
include BWAPI::Client::Admin::Clients::Users::Sharing
|
|
86
|
-
|
|
87
87
|
end
|
|
88
88
|
end
|
|
89
89
|
end
|
|
90
90
|
end
|
|
91
|
-
end
|
|
91
|
+
end
|