bwapi 6.5.0.pre.256 → 7.0.0.pre.271

Sign up to get free protection for your applications and to get access to all the features.
Files changed (91) hide show
  1. checksums.yaml +8 -8
  2. data/.editorconfig +11 -0
  3. data/.rubocop.yml +17 -0
  4. data/.travis.yml +7 -3
  5. data/bin/bwapi +2 -1
  6. data/bwapi.gemspec +13 -10
  7. data/lib/bwapi.rb +6 -6
  8. data/lib/bwapi/authentication.rb +9 -17
  9. data/lib/bwapi/client.rb +5 -4
  10. data/lib/bwapi/client/admin.rb +6 -6
  11. data/lib/bwapi/client/admin/become.rb +4 -4
  12. data/lib/bwapi/client/admin/search.rb +9 -12
  13. data/lib/bwapi/client/admin/sub_clients.rb +8 -13
  14. data/lib/bwapi/client/admin/users.rb +7 -7
  15. data/lib/bwapi/client/admin/users/sharing.rb +5 -7
  16. data/lib/bwapi/client/brandwatch.rb +4 -4
  17. data/lib/bwapi/client/brandwatch/become.rb +4 -4
  18. data/lib/bwapi/client/brandwatch/client_modules.rb +5 -6
  19. data/lib/bwapi/client/client.rb +5 -6
  20. data/lib/bwapi/client/command_center.rb +3 -3
  21. data/lib/bwapi/client/command_center/client.rb +4 -4
  22. data/lib/bwapi/client/command_center/displays.rb +9 -9
  23. data/lib/bwapi/client/command_center/displays/events.rb +8 -8
  24. data/lib/bwapi/client/command_center/displays/messages.rb +7 -8
  25. data/lib/bwapi/client/command_center/displays/scenes.rb +9 -9
  26. data/lib/bwapi/client/command_center/displays/screens.rb +9 -9
  27. data/lib/bwapi/client/command_center/displays/users.rb +7 -8
  28. data/lib/bwapi/client/command_center/displays/users/access.rb +4 -5
  29. data/lib/bwapi/client/command_center/scene_types.rb +6 -6
  30. data/lib/bwapi/client/command_center/themes.rb +4 -4
  31. data/lib/bwapi/client/command_center/users.rb +6 -6
  32. data/lib/bwapi/client/command_center/users/access.rb +5 -5
  33. data/lib/bwapi/client/error_codes.rb +4 -4
  34. data/lib/bwapi/client/filters.rb +4 -4
  35. data/lib/bwapi/client/languages.rb +3 -3
  36. data/lib/bwapi/client/location.rb +5 -5
  37. data/lib/bwapi/client/logout.rb +12 -14
  38. data/lib/bwapi/client/me.rb +3 -3
  39. data/lib/bwapi/client/metrics.rb +3 -3
  40. data/lib/bwapi/client/oauth.rb +8 -8
  41. data/lib/bwapi/client/ping.rb +8 -8
  42. data/lib/bwapi/client/projects.rb +10 -10
  43. data/lib/bwapi/client/projects/bulkactions.rb +4 -4
  44. data/lib/bwapi/client/projects/bulkactions/author.rb +4 -3
  45. data/lib/bwapi/client/projects/bulkactions/mentions.rb +4 -3
  46. data/lib/bwapi/client/projects/categories.rb +6 -20
  47. data/lib/bwapi/client/projects/data.rb +4 -5
  48. data/lib/bwapi/client/projects/data/mentions.rb +7 -7
  49. data/lib/bwapi/client/projects/data/volume.rb +11 -11
  50. data/lib/bwapi/client/projects/data_download.rb +6 -7
  51. data/lib/bwapi/client/projects/demographics.rb +3 -4
  52. data/lib/bwapi/client/projects/facebook_queries.rb +8 -9
  53. data/lib/bwapi/client/projects/group.rb +2 -2
  54. data/lib/bwapi/client/projects/group/author_group.rb +8 -7
  55. data/lib/bwapi/client/projects/group/location_group.rb +7 -7
  56. data/lib/bwapi/client/projects/group/site_group.rb +7 -7
  57. data/lib/bwapi/client/projects/queries.rb +9 -10
  58. data/lib/bwapi/client/projects/queries/backfill.rb +6 -8
  59. data/lib/bwapi/client/projects/queries/date_range.rb +9 -9
  60. data/lib/bwapi/client/projects/queries/mentions.rb +5 -8
  61. data/lib/bwapi/client/projects/query_groups.rb +7 -9
  62. data/lib/bwapi/client/projects/rules.rb +7 -9
  63. data/lib/bwapi/client/projects/rules/backfill.rb +4 -4
  64. data/lib/bwapi/client/projects/rules/copy.rb +4 -4
  65. data/lib/bwapi/client/projects/sharing.rb +8 -9
  66. data/lib/bwapi/client/projects/signals.rb +5 -5
  67. data/lib/bwapi/client/projects/stream_dashboards.rb +10 -10
  68. data/lib/bwapi/client/projects/stream_dashboards/streams.rb +6 -7
  69. data/lib/bwapi/client/projects/summary.rb +5 -6
  70. data/lib/bwapi/client/projects/tags.rb +8 -9
  71. data/lib/bwapi/client/projects/twitter_queries.rb +7 -8
  72. data/lib/bwapi/client/projects/users.rb +4 -4
  73. data/lib/bwapi/client/projects/workflow.rb +4 -4
  74. data/lib/bwapi/client/query_validation.rb +7 -7
  75. data/lib/bwapi/client/sso.rb +4 -4
  76. data/lib/bwapi/client/test_search.rb +9 -8
  77. data/lib/bwapi/client/user.rb +6 -6
  78. data/lib/bwapi/client/user/notifications.rb +8 -8
  79. data/lib/bwapi/configuration.rb +6 -6
  80. data/lib/bwapi/connection.rb +10 -19
  81. data/lib/bwapi/error.rb +43 -36
  82. data/lib/bwapi/request.rb +24 -27
  83. data/lib/bwapi/version.rb +5 -2
  84. data/lib/faraday/response/brandwatch_error.rb +21 -22
  85. data/spec/bwapi/authentication_spec.rb +7 -7
  86. data/spec/bwapi/client_spec.rb +17 -17
  87. data/spec/bwapi_spec.rb +3 -3
  88. data/spec/fixtures/.netrc +1 -1
  89. data/spec/helper.rb +4 -2
  90. metadata +61 -4
  91. data/lib/faraday/utils/utils.rb +0 -26
@@ -1,15 +1,16 @@
1
+ # encoding: utf-8
2
+
1
3
  module BWAPI
2
4
  class Client
3
5
  module CommandCenter
4
6
  module Displays
5
7
  # Displays module for commandcenter/displays/screens endpoints
6
8
  module Screens
7
-
8
9
  # Get the screens for a display
9
10
  #
10
11
  # @param [Integer] display_id The display id
11
12
  # @return [Hashie::Mash] All screens for display
12
- def screens display_id
13
+ def screens(display_id)
13
14
  get "commandcenter/displays/#{display_id}/screens"
14
15
  end
15
16
 
@@ -18,7 +19,7 @@ module BWAPI
18
19
  # @param [Integer] display_id The display id
19
20
  # @param [Integer] screen_id The screen id
20
21
  # @return [Hashie::Mash] Specific screen for display
21
- def get_screen display_id, screen_id
22
+ def get_screen(display_id, screen_id)
22
23
  get "commandcenter/displays/#{display_id}/screens/#{screen_id}"
23
24
  end
24
25
 
@@ -27,7 +28,7 @@ module BWAPI
27
28
  # @param [Integer] display_id The display id
28
29
  # @param [Integer] screen_id The screen id
29
30
  # @return [Hashie::Mash] Specific screen for display with scenes
30
- def get_screen_with_scenes display_id, screen_id
31
+ def get_screen_with_scenes(display_id, screen_id)
31
32
  get "commandcenter/displays/#{display_id}/screens/#{screen_id}/withscenes"
32
33
  end
33
34
 
@@ -43,7 +44,7 @@ module BWAPI
43
44
  # @option opts [String] created Date screen was created
44
45
  # @option opts [Boolean] enabled Whether screen is enabled
45
46
  # @return [Hashie::Mash] New display screen
46
- def create_screen display_id, opts={}
47
+ def create_screen(display_id, opts = {})
47
48
  post "commandcenter/displays/#{display_id}/screens", opts
48
49
  end
49
50
 
@@ -59,7 +60,7 @@ module BWAPI
59
60
  # @option opts [String] created Date screen was created
60
61
  # @option opts [Boolean] enabled Whether screen is enabled
61
62
  # @return [Hashie::Mash] Updated display screen
62
- def update_screen display_id, screen_id, opts={}
63
+ def update_screen(display_id, screen_id, opts = {})
63
64
  put "commandcenter/displays/#{display_id}/screens/#{screen_id}", opts
64
65
  end
65
66
 
@@ -68,12 +69,11 @@ module BWAPI
68
69
  # @param [Integer] display_id The display id
69
70
  # @param [Integer] screen_id The screen id
70
71
  # @return [Hashie::Mash] Deleted display screen
71
- def delete_screen display_id, screen_id
72
+ def delete_screen(display_id, screen_id)
72
73
  delete "commandcenter/displays/#{display_id}/screens/#{screen_id}"
73
74
  end
74
-
75
75
  end
76
76
  end
77
77
  end
78
78
  end
79
- end
79
+ end
@@ -1,3 +1,5 @@
1
+ # encoding: utf-8
2
+
1
3
  require 'bwapi/client/command_center/displays/users/access'
2
4
 
3
5
  module BWAPI
@@ -6,20 +8,18 @@ module BWAPI
6
8
  module Displays
7
9
  # Users module for commandcenter/displays/users endpoints
8
10
  module Users
9
-
10
11
  # Get all users display access levels
11
12
  #
12
13
  # @return [Hashie::Mash] Display access levels
13
14
  def displays_access_levels
14
- get "commandcenter/displays/users"
15
+ get 'commandcenter/displays/users'
15
16
  end
16
17
 
17
18
  # Get a users display access levels for displays
18
19
  #
19
- # @param [Integer] display_id the display id
20
20
  # @param [Integer] user_id the user id
21
21
  # @return [Hashie::Mash] Specific display user access levels
22
- def get_displays_user_access_levels display_id, user_id
22
+ def get_displays_user_access_levels(user_id)
23
23
  get "commandcenter/displays/users/#{user_id}"
24
24
  end
25
25
 
@@ -27,7 +27,7 @@ module BWAPI
27
27
  #
28
28
  # @param [Integer] display_id the display id
29
29
  # @return [Hashie::Mash] Specific display user access levels
30
- def get_display_users_access_levels display_id
30
+ def get_display_users_access_levels(display_id)
31
31
  get "commandcenter/displays/#{display_id}/users"
32
32
  end
33
33
 
@@ -36,7 +36,7 @@ module BWAPI
36
36
  # @param [Integer] display_id the display id
37
37
  # @param [Integer] user_id the user id
38
38
  # @return [Hashie::Mash] Specific display and user access level
39
- def get_display_user_access_levels display_id, user_id
39
+ def get_display_user_access_levels(display_id, user_id)
40
40
  get "commandcenter/displays/#{display_id}/users/#{user_id}"
41
41
  end
42
42
 
@@ -45,12 +45,11 @@ module BWAPI
45
45
  # @param [Integer] display_id the display id
46
46
  # @param [Integer] user_id the user id
47
47
  # @return [Hashie::Mash] Specific display and user access level
48
- def delete_display_user_access_levels display_id, user_id
48
+ def delete_display_user_access_levels(display_id, user_id)
49
49
  delete "commandcenter/displays/#{display_id}/users/#{user_id}"
50
50
  end
51
51
 
52
52
  include BWAPI::Client::CommandCenter::Displays::Users::Access
53
-
54
53
  end
55
54
  end
56
55
  end
@@ -1,3 +1,4 @@
1
+ # encoding: utf-8
1
2
  module BWAPI
2
3
  class Client
3
4
  module CommandCenter
@@ -5,14 +6,13 @@ module BWAPI
5
6
  module Users
6
7
  # Displays module for commandcenter/displays/users/access endpoints
7
8
  module Access
8
-
9
9
  # Grant a display user access level
10
10
  #
11
11
  # @param [Integer] display_id the display id
12
12
  # @param [Integer] user_id the user id
13
13
  # @param [Integer] access_level the access level
14
14
  # @return [Hashie::Mash] Updated user access level
15
- def grant_display_user_access_level display_id, user_id, access_level
15
+ def grant_display_user_access_level(display_id, user_id, access_level)
16
16
  post "commandcenter/displays/#{display_id}/users/#{user_id}/access/#{access_level}"
17
17
  end
18
18
 
@@ -22,13 +22,12 @@ module BWAPI
22
22
  # @param [Integer] user_id the user id
23
23
  # @param [Integer] access_level the access level
24
24
  # @return [Hashie::Mash] Updated user access level
25
- def update_display_user_access_level display_id, user_id, access_level
25
+ def update_display_user_access_level(display_id, user_id, access_level)
26
26
  put "commandcenter/displays/#{display_id}/users/#{user_id}/access/#{access_level}"
27
27
  end
28
-
29
28
  end
30
29
  end
31
30
  end
32
31
  end
33
32
  end
34
- end
33
+ end
@@ -1,21 +1,22 @@
1
+ # encoding: utf-8
2
+
1
3
  module BWAPI
2
4
  class Client
3
5
  module CommandCenter
4
6
  # Displays module for commandcenter/scenetypes endpoints
5
7
  module SceneTypes
6
-
7
8
  # Get the scene types visible to the user
8
9
  #
9
10
  # @return [Hashie::Mash] All scene types
10
11
  def scene_types
11
- get "commandcenter/scenetypes"
12
+ get 'commandcenter/scenetypes'
12
13
  end
13
14
 
14
15
  # Get an existing scene type
15
16
  #
16
17
  # @param [Integer] scene_type_id the scene type id
17
18
  # @return [Hashie::Mash] Specific scene type
18
- def get_scene_type scene_type_id
19
+ def get_scene_type(scene_type_id)
19
20
  get "commandcenter/scenetypes/#{scene_type_id}"
20
21
  end
21
22
 
@@ -23,11 +24,10 @@ module BWAPI
23
24
  #
24
25
  # @param [Integer] scene_type_id the scene type id
25
26
  # @return [Hashie::Mash] Specific scene type with sub scences
26
- def get_scene_type_with_sub_scenes scene_type_id
27
+ def get_scene_type_with_sub_scenes(scene_type_id)
27
28
  get "commandcenter/scenetypes/#{scene_type_id}"
28
29
  end
29
-
30
30
  end
31
31
  end
32
32
  end
33
- end
33
+ end
@@ -1,17 +1,17 @@
1
+ # encoding: utf-8
2
+
1
3
  module BWAPI
2
4
  class Client
3
5
  module CommandCenter
4
6
  # Themes module for commandcenter/themes endpoints
5
7
  module Themes
6
-
7
8
  # Get themes for client
8
9
  #
9
10
  # @return [Hashie::Mash] All themes
10
11
  def themes
11
- get "commandcenter/themes"
12
+ get 'commandcenter/themes'
12
13
  end
13
-
14
14
  end
15
15
  end
16
16
  end
17
- end
17
+ end
@@ -1,3 +1,5 @@
1
+ # encoding: utf-8
2
+
1
3
  require 'bwapi/client/command_center/users/access'
2
4
 
3
5
  module BWAPI
@@ -5,19 +7,18 @@ module BWAPI
5
7
  module CommandCenter
6
8
  # Users module for commandcenter/users endpoints
7
9
  module Users
8
-
9
10
  # Get the access levels for all users
10
11
  #
11
12
  # @return [Hashie::Mash] All users access levels
12
13
  def users_access_levels
13
- get "commandcenter/users"
14
+ get 'commandcenter/users'
14
15
  end
15
16
 
16
17
  # Get an existing user access level
17
18
  #
18
19
  # @param [Integer] user_id the user id
19
20
  # @return [Hashie::Mash] Specific user access level
20
- def get_user_access_level user_id
21
+ def get_user_access_level(user_id)
21
22
  get "commandcenter/users/#{user_id}"
22
23
  end
23
24
 
@@ -25,13 +26,12 @@ module BWAPI
25
26
  #
26
27
  # @param [Integer] user_id the user id
27
28
  # @return [Hashie::Mash] Deleted user access level
28
- def delete_user_access_level user_id
29
+ def delete_user_access_level(user_id)
29
30
  delete "commandcenter/users/#{user_id}"
30
31
  end
31
32
 
32
33
  include BWAPI::Client::CommandCenter::Users::Access
33
-
34
34
  end
35
35
  end
36
36
  end
37
- end
37
+ end
@@ -1,21 +1,21 @@
1
+ # encoding: utf-8
2
+
1
3
  module BWAPI
2
4
  class Client
3
5
  module CommandCenter
4
- # Users module for commandcenter/users/access endpoints
5
6
  module Users
7
+ # Users module for commandcenter/users/access endpoints
6
8
  module Access
7
-
8
9
  # Update an existing user access level
9
10
  #
10
11
  # @param [Integer] user_id the user id
11
12
  # @param [Integer] access_level the access level
12
13
  # @return [Hashie::Mash] Updated user access level
13
- def update_user_access_level user_id, access_level
14
+ def update_user_access_level(user_id, access_level)
14
15
  put "commandcenter/users/#{user_id}/access/#{access_level}"
15
16
  end
16
-
17
17
  end
18
18
  end
19
19
  end
20
20
  end
21
- end
21
+ end
@@ -1,15 +1,15 @@
1
+ # encoding: utf-8
2
+
1
3
  module BWAPI
2
4
  class Client
3
5
  # ErrorCodes module for errorCodes endpoint
4
6
  module ErrorCodes
5
-
6
7
  # Get the api error codes
7
8
  #
8
9
  # @return [Hashie::Mash] Error codes information
9
10
  def error_codes
10
- get "errorCodes"
11
+ get 'errorCodes'
11
12
  end
12
-
13
13
  end
14
14
  end
15
- end
15
+ end
@@ -1,15 +1,15 @@
1
+ # encoding: utf-8
2
+
1
3
  module BWAPI
2
4
  class Client
3
5
  # Filters module for filters endpoint
4
6
  module Filters
5
-
6
7
  # Get the currently supported filters
7
8
  #
8
9
  # @return [Hashie::Mash] Current filters
9
10
  def filters
10
- get "filters"
11
+ get 'filters'
11
12
  end
12
-
13
13
  end
14
14
  end
15
- end
15
+ end
@@ -1,15 +1,15 @@
1
+ # encoding: utf-8
2
+
1
3
  module BWAPI
2
4
  class Client
3
5
  # Languages module for languages endpoints
4
6
  module Languages
5
-
6
7
  # Get the current language list
7
8
  #
8
9
  # @return [Hashie::Mash] Languages information
9
10
  def languages
10
- get "languages"
11
+ get 'languages'
11
12
  end
12
-
13
13
  end
14
14
  end
15
15
  end
@@ -1,12 +1,13 @@
1
+ # encoding: utf-8
2
+
1
3
  module BWAPI
2
4
  class Client
3
5
  # Location module for locations endpoints
4
6
  module Location
5
-
6
7
  # Request the information for a given location code
7
8
  #
8
9
  # @return [Hashie::Mash] Information about the location
9
- def location location_code
10
+ def location(location_code)
10
11
  get "location/#{location_code}"
11
12
  end
12
13
 
@@ -17,10 +18,9 @@ module BWAPI
17
18
  # @option opts [Integer] page number of results to retrieve
18
19
  # @option opts [Integer] pageSize of the results to retrieve
19
20
  # @return [Hashie::Mash] The list of matching locations
20
- def location_autocomplete opts={}
21
- post "location/autocomplete", opts
21
+ def location_autocomplete(opts = {})
22
+ post 'location/autocomplete', opts
22
23
  end
23
-
24
24
  end
25
25
  end
26
26
  end
@@ -1,25 +1,23 @@
1
+ # encoding: utf-8
2
+
1
3
  module BWAPI
2
4
  class Client
3
5
  # Logout module for logout endpoint
4
6
  module Logout
5
-
6
7
  # Logout user
7
8
  #
8
9
  # @return [Hashie::Mash] Logout information
9
10
  def logout
10
- begin
11
- get "logout"
12
- ensure
13
- self.access_token = nil
14
- self.refresh_token = nil
15
- self.username = nil
16
- self.password = nil
17
- self.client_id = nil
18
- self.grant_type = nil
19
- self.expires_in = nil
20
- end
11
+ get 'logout'
12
+ ensure
13
+ self.access_token = nil
14
+ self.refresh_token = nil
15
+ self.username = nil
16
+ self.password = nil
17
+ self.client_id = nil
18
+ self.grant_type = nil
19
+ self.expires_in = nil
21
20
  end
22
-
23
21
  end
24
22
  end
25
- end
23
+ end
@@ -1,8 +1,9 @@
1
+ # encoding: utf-8
2
+
1
3
  module BWAPI
2
4
  class Client
3
5
  # Me module for me endpoint and helper methods
4
6
  module Me
5
-
6
7
  # Get user information
7
8
  #
8
9
  # @return [Hashie::Mash] User information
@@ -37,7 +38,6 @@ module BWAPI
37
38
  def user_id
38
39
  me.id
39
40
  end
40
-
41
41
  end
42
42
  end
43
- end
43
+ end
@@ -1,15 +1,15 @@
1
+ # encoding: utf-8
2
+
1
3
  module BWAPI
2
4
  class Client
3
5
  # Metrics module for metrics endpoints
4
6
  module Metrics
5
-
6
7
  # Get the current metrics list
7
8
  #
8
9
  # @return [Hashie::Mash] Metrics information
9
10
  def metrics
10
- get "metrics"
11
+ get 'metrics'
11
12
  end
12
-
13
13
  end
14
14
  end
15
15
  end