bwapi 10.0.0 → 11.0.0.pre.550

Sign up to get free protection for your applications and to get access to all the features.
Files changed (68) hide show
  1. checksums.yaml +13 -5
  2. data/.editorconfig +1 -1
  3. data/.gitignore +1 -1
  4. data/lib/bwapi/client.rb +26 -3
  5. data/lib/bwapi/client/admin.rb +2 -0
  6. data/lib/bwapi/client/admin/demographics.rb +17 -0
  7. data/lib/bwapi/client/aggregates.rb +13 -0
  8. data/lib/bwapi/client/author.rb +56 -0
  9. data/lib/bwapi/client/brandwatch.rb +6 -0
  10. data/lib/bwapi/client/brandwatch/become.rb +0 -2
  11. data/lib/bwapi/client/brandwatch/clients.rb +2 -8
  12. data/lib/bwapi/client/brandwatch/clients/command_center.rb +20 -0
  13. data/lib/bwapi/client/brandwatch/clients/command_center/limits.rb +33 -0
  14. data/lib/bwapi/client/brandwatch/clients/command_center/scene_types.rb +26 -0
  15. data/lib/bwapi/client/brandwatch/clients/command_center/themes.rb +26 -0
  16. data/lib/bwapi/client/brandwatch/clients/command_center/users.rb +30 -0
  17. data/lib/bwapi/client/brandwatch/clients/command_center/users/access.rb +28 -0
  18. data/lib/bwapi/client/brandwatch/clients/users.rb +0 -2
  19. data/lib/bwapi/client/brandwatch/command_center.rb +14 -0
  20. data/lib/bwapi/client/brandwatch/command_center/scene_types.rb +31 -0
  21. data/lib/bwapi/client/brandwatch/command_center/themes.rb +17 -0
  22. data/lib/bwapi/client/brandwatch/log_level.rb +17 -0
  23. data/lib/bwapi/client/brandwatch/price_structures.rb +45 -0
  24. data/lib/bwapi/client/brandwatch/usage_report.rb +19 -0
  25. data/lib/bwapi/client/command_center.rb +12 -0
  26. data/lib/bwapi/client/command_center/category_colours.rb +15 -0
  27. data/lib/bwapi/client/command_center/colour_palette.rb +22 -0
  28. data/lib/bwapi/client/command_center/display_access.rb +12 -0
  29. data/lib/bwapi/client/command_center/display_access/users.rb +14 -0
  30. data/lib/bwapi/client/command_center/display_access/users/access.rb +21 -0
  31. data/lib/bwapi/client/command_center/displays/scenes.rb +1 -1
  32. data/lib/bwapi/client/command_center/projects.rb +16 -0
  33. data/lib/bwapi/client/command_center/projects/category_colours.rb +45 -0
  34. data/lib/bwapi/client/command_center/projects/data.rb +21 -0
  35. data/lib/bwapi/client/command_center/projects/tag_colours.rb +45 -0
  36. data/lib/bwapi/client/command_center/query_colours.rb +36 -0
  37. data/lib/bwapi/client/command_center/scene_types.rb +3 -3
  38. data/lib/bwapi/client/command_center/tag_colours.rb +15 -0
  39. data/lib/bwapi/client/dimensions.rb +13 -0
  40. data/lib/bwapi/client/oauth.rb +2 -1
  41. data/lib/bwapi/client/projects.rb +13 -11
  42. data/lib/bwapi/client/projects/{bulkactions.rb → bulk_actions.rb} +2 -2
  43. data/lib/bwapi/client/projects/{bulkactions → bulk_actions}/author.rb +0 -0
  44. data/lib/bwapi/client/projects/{bulkactions → bulk_actions}/mentions.rb +0 -0
  45. data/lib/bwapi/client/projects/data.rb +20 -0
  46. data/lib/bwapi/client/projects/data/audience.rb +21 -0
  47. data/lib/bwapi/client/projects/data/audience_activity.rb +21 -0
  48. data/lib/bwapi/client/projects/data/channel_metrics.rb +21 -0
  49. data/lib/bwapi/client/projects/data/emoticons.rb +23 -0
  50. data/lib/bwapi/client/projects/data/hashtags.rb +23 -0
  51. data/lib/bwapi/client/projects/data/headlines.rb +20 -0
  52. data/lib/bwapi/client/projects/data/impressions.rb +21 -0
  53. data/lib/bwapi/client/projects/data/mentioned_authors.rb +23 -0
  54. data/lib/bwapi/client/projects/data/mentions.rb +32 -2
  55. data/lib/bwapi/client/projects/data/owner_activity.rb +21 -0
  56. data/lib/bwapi/client/projects/data/urls.rb +23 -0
  57. data/lib/bwapi/client/projects/query/mentionfind.rb +21 -0
  58. data/lib/bwapi/client/projects/signals/groups.rb +18 -5
  59. data/lib/bwapi/client/user.rb +2 -0
  60. data/lib/bwapi/client/user/instagram_credentials.rb +32 -0
  61. data/lib/bwapi/configuration.rb +3 -2
  62. data/lib/bwapi/default.rb +7 -3
  63. data/lib/bwapi/error.rb +0 -2
  64. data/lib/bwapi/version.rb +1 -1
  65. data/spec/bwapi/client_spec.rb +29 -167
  66. data/spec/bwapi/configuration_spec.rb +499 -0
  67. data/spec/bwapi/default_spec.rb +242 -0
  68. metadata +72 -30
@@ -1,7 +1,7 @@
1
1
  module BWAPI
2
2
  class Client
3
3
  module CommandCenter
4
- # Displays module for commandcenter/scenetypes endpoints
4
+ # SceneTypes module for commandcenter/scenetypes endpoints
5
5
  module SceneTypes
6
6
  # Get the scene types visible to the user
7
7
  #
@@ -18,12 +18,12 @@ module BWAPI
18
18
  get "commandcenter/scenetypes/#{scene_type_id}"
19
19
  end
20
20
 
21
- # Get an existing scene type
21
+ # Get an existing scene type sub scene types
22
22
  #
23
23
  # @param [Integer] scene_type_id the scene type id
24
24
  # @return [Hash] Specific scene type with sub scences
25
25
  def get_scene_type_with_sub_scenes(scene_type_id)
26
- get "commandcenter/scenetypes/#{scene_type_id}"
26
+ get "commandcenter/scenetypes/#{scene_type_id}/subscenes"
27
27
  end
28
28
  end
29
29
  end
@@ -0,0 +1,15 @@
1
+ module BWAPI
2
+ class Client
3
+ module CommandCenter
4
+ # TagColours module for commandcenter/tagColours endpoints
5
+ module TagColours
6
+ # Get colours defined for tags in current client
7
+ #
8
+ # TODO: Add parameters documentation
9
+ def all_tag_colours
10
+ get 'commandcenter/tagColours'
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,13 @@
1
+ module BWAPI
2
+ class Client
3
+ # Dimemsions module for dimensions endpoint
4
+ module Dimensions
5
+ # Get the currently supported dimensions
6
+ #
7
+ # @return [array] Current dimensions
8
+ def dimensions
9
+ get 'dimensions'
10
+ end
11
+ end
12
+ end
13
+ end
@@ -61,7 +61,8 @@ module BWAPI
61
61
  # @param opts [Hash] options hash of parameters
62
62
  def oauth_request(opts = {})
63
63
  response = post('oauth/token', opts)
64
- self.access_token = response['access_token']
64
+ self.access_token = response['access_token']
65
+ self.access_token_expiry = Time.at(Time.now.to_i + response['expires_in']).iso8601
65
66
  self.refresh_token = response['refresh_token'] if application_client?
66
67
  response
67
68
  end
@@ -1,19 +1,20 @@
1
- require 'bwapi/client/projects/bulkactions'
1
+ require 'bwapi/client/projects/bulk_actions'
2
2
  require 'bwapi/client/projects/categories'
3
3
  require 'bwapi/client/projects/data'
4
4
  require 'bwapi/client/projects/data_download'
5
5
  require 'bwapi/client/projects/demographics'
6
6
  require 'bwapi/client/projects/facebook_queries'
7
- require 'bwapi/client/projects/twitter_queries'
8
7
  require 'bwapi/client/projects/group'
9
- require 'bwapi/client/projects/signals'
10
- require 'bwapi/client/projects/summary'
11
- require 'bwapi/client/projects/sharing'
12
- require 'bwapi/client/projects/stream_dashboards'
13
8
  require 'bwapi/client/projects/queries'
9
+ require 'bwapi/client/projects/query/mentionfind'
14
10
  require 'bwapi/client/projects/query_groups'
15
11
  require 'bwapi/client/projects/rules'
12
+ require 'bwapi/client/projects/sharing'
13
+ require 'bwapi/client/projects/signals'
14
+ require 'bwapi/client/projects/stream_dashboards'
15
+ require 'bwapi/client/projects/summary'
16
16
  require 'bwapi/client/projects/tags'
17
+ require 'bwapi/client/projects/twitter_queries'
17
18
  require 'bwapi/client/projects/users'
18
19
  require 'bwapi/client/projects/workflow'
19
20
 
@@ -87,15 +88,16 @@ module BWAPI
87
88
  include BWAPI::Client::Projects::Demographics
88
89
  include BWAPI::Client::Projects::FacebookQueries
89
90
  include BWAPI::Client::Projects::Group
90
- include BWAPI::Client::Projects::TwitterQueries
91
- include BWAPI::Client::Projects::Signals
92
- include BWAPI::Client::Projects::Summary
93
- include BWAPI::Client::Projects::Sharing
94
- include BWAPI::Client::Projects::StreamDashboards
95
91
  include BWAPI::Client::Projects::Queries
92
+ include BWAPI::Client::Projects::Query::MentionFind
96
93
  include BWAPI::Client::Projects::QueryGroups
97
94
  include BWAPI::Client::Projects::Rules
95
+ include BWAPI::Client::Projects::Sharing
96
+ include BWAPI::Client::Projects::Signals
97
+ include BWAPI::Client::Projects::StreamDashboards
98
+ include BWAPI::Client::Projects::Summary
98
99
  include BWAPI::Client::Projects::Tags
100
+ include BWAPI::Client::Projects::TwitterQueries
99
101
  include BWAPI::Client::Projects::Users
100
102
  include BWAPI::Client::Projects::Workflow
101
103
  end
@@ -1,5 +1,5 @@
1
- require 'bwapi/client/projects/bulkactions/mentions'
2
- require 'bwapi/client/projects/bulkactions/author'
1
+ require 'bwapi/client/projects/bulk_actions/mentions'
2
+ require 'bwapi/client/projects/bulk_actions/author'
3
3
 
4
4
  module BWAPI
5
5
  class Client
@@ -1,4 +1,14 @@
1
+ require 'bwapi/client/projects/data/audience'
2
+ require 'bwapi/client/projects/data/audience_activity'
3
+ require 'bwapi/client/projects/data/channel_metrics'
4
+ require 'bwapi/client/projects/data/emoticons'
5
+ require 'bwapi/client/projects/data/hashtags'
6
+ require 'bwapi/client/projects/data/headlines'
7
+ require 'bwapi/client/projects/data/mentioned_authors'
8
+ require 'bwapi/client/projects/data/impressions'
1
9
  require 'bwapi/client/projects/data/mentions'
10
+ require 'bwapi/client/projects/data/owner_activity'
11
+ require 'bwapi/client/projects/data/urls'
2
12
  require 'bwapi/client/projects/data/volume'
3
13
 
4
14
  module BWAPI
@@ -29,7 +39,17 @@ module BWAPI
29
39
  get "projects/#{project_id}/data/headlines", opts
30
40
  end
31
41
 
42
+ include BWAPI::Client::Projects::Data::Audience
43
+ include BWAPI::Client::Projects::Data::AudienceActivity
44
+ include BWAPI::Client::Projects::Data::ChannelMetrics
45
+ include BWAPI::Client::Projects::Data::Emoticons
46
+ include BWAPI::Client::Projects::Data::Hashtags
47
+ include BWAPI::Client::Projects::Data::Headlines
48
+ include BWAPI::Client::Projects::Data::Impressions
49
+ include BWAPI::Client::Projects::Data::MentionedAuthors
32
50
  include BWAPI::Client::Projects::Data::Mentions
51
+ include BWAPI::Client::Projects::Data::OwnerActivity
52
+ include BWAPI::Client::Projects::Data::Urls
33
53
  include BWAPI::Client::Projects::Data::Volume
34
54
  end
35
55
  end
@@ -0,0 +1,21 @@
1
+ module BWAPI
2
+ class Client
3
+ module Projects
4
+ module Data
5
+ # Audience module for projects/data/audience endpoints
6
+ module Audience
7
+ # Get all audience data for queries broken down by a second dimension
8
+ #
9
+ # @param project_id [Integer] Id of project
10
+ # @param dimension_two [String] Dimension 2 value
11
+ # @param opts [Hash] options hash of parameters
12
+ # @option opts [Hash] filter The filters to apply
13
+ # @return [Hash] All data audience queries mentions
14
+ def data_audience_queries(project_id, dimension_two, opts = {})
15
+ get "projects/#{project_id}/data/audience/queries/#{dimension_two}", opts
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,21 @@
1
+ module BWAPI
2
+ class Client
3
+ module Projects
4
+ module Data
5
+ # AudienceActivity module for projects/data/audienceActivity endpoints
6
+ module AudienceActivity
7
+ # Get all audience activity data for queries broken down by a second dimension
8
+ #
9
+ # @param project_id [Integer] Id of project
10
+ # @param dimension_two [String] Dimension 2 value
11
+ # @param opts [Hash] options hash of parameters
12
+ # @option opts [Hash] filter The filters to apply
13
+ # @return [Hash] All data audience activity queries mentions
14
+ def data_audience_activity_queries(project_id, dimension_two, opts = {})
15
+ get "projects/#{project_id}/data/audienceActivity/queries/#{dimension_two}", opts
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,21 @@
1
+ module BWAPI
2
+ class Client
3
+ module Projects
4
+ module Data
5
+ # ChannelMetrics module for projects/data/channelMetrics endpoints
6
+ module ChannelMetrics
7
+ # Get all channel metrics data for queries broken down by a second dimension
8
+ #
9
+ # @param project_id [Integer] Id of project
10
+ # @param dimension_two [String] Dimension 2 value
11
+ # @param opts [Hash] options hash of parameters
12
+ # @option opts [Hash] filter The filters to apply
13
+ # @return [Hash] All data channel metrics queries mentions
14
+ def data_channel_metrics_queries(project_id, dimension_two, opts = {})
15
+ get "projects/#{project_id}/data/channelMetrics/queries/#{dimension_two}", opts
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,23 @@
1
+ module BWAPI
2
+ class Client
3
+ module Projects
4
+ module Data
5
+ # Emoticons module for the /projects/{project_id}/data/emoticons endpoint
6
+ module Emoticons
7
+ # Get top n emoticons
8
+ #
9
+ # @param project_id [Integer] Id of project
10
+ # @param opts [Hash] options hash of parameters
11
+ # @option opts [Hash] filter The filters to apply
12
+ # @option opts [Integer] limit The limit to return
13
+ # @option opts [String] orderBy Parameter to sort by
14
+ # @option opts [String] orderDirection Direction of sort
15
+ # @return [array] top n emoticons based on parameter passed
16
+ def data_emoticons(project_id, opts = {})
17
+ get "/projects/#{project_id}/data/emoticons", opts
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,23 @@
1
+ module BWAPI
2
+ class Client
3
+ module Projects
4
+ module Data
5
+ # Hashtags module for the /projects/{project_id}/data/hashtags endpoint
6
+ module Hashtags
7
+ # Get top n hashtags
8
+ #
9
+ # @param project_id [Integer] Id of project
10
+ # @param opts [Hash] options hash of parameters
11
+ # @option opts [Hash] filter The filters to apply
12
+ # @option opts [Integer] limit The limit to return
13
+ # @option opts [String] orderBy Parameter to sort by
14
+ # @option opts [String] orderDirection Direction of sort
15
+ # @return [array] top n hashtags based on parameter passed
16
+ def data_hashtags(project_id, opts = {})
17
+ get "/projects/#{project_id}/data/hashtags", opts
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,20 @@
1
+ module BWAPI
2
+ class Client
3
+ module Projects
4
+ module Data
5
+ # Headlines module for projects/data/headlines endpoints
6
+ module Headlines
7
+ # Get mention headlines that fall within the submitted filters
8
+ #
9
+ # @param project_id [Integer] Id of project
10
+ # @param opts [Hash] options hash of parameters
11
+ # @option opts [Hash] filter The filters to apply
12
+ # @return [Hash] All Mention headlines
13
+ def data_headlines(project_id, opts = {})
14
+ get "projects/#{project_id}/data/headlines", opts
15
+ end
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,21 @@
1
+ module BWAPI
2
+ class Client
3
+ module Projects
4
+ module Data
5
+ # Impressions module for projects/data/impressions endpoints
6
+ module Impressions
7
+ # Get all impressions data for queries broken down by a second dimension
8
+ #
9
+ # @param project_id [Integer] Id of project
10
+ # @param dimension_two [String] Dimension 2 value
11
+ # @param opts [Hash] options hash of parameters
12
+ # @option opts [Hash] filter The filters to apply
13
+ # @return [Hash] All data impressions queries mentions
14
+ def data_impressions_queries(project_id, dimension_two, opts = {})
15
+ get "projects/#{project_id}/data/impressions/queries/#{dimension_two}", opts
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,23 @@
1
+ module BWAPI
2
+ class Client
3
+ module Projects
4
+ module Data
5
+ # MentionedAuthors module for the /projects/{project_id}/data/mentionedauthors endpoint
6
+ module MentionedAuthors
7
+ # Get top n mentioned authors
8
+ #
9
+ # @param project_id [Integer] Id of project
10
+ # @param opts [Hash] options hash of parameters
11
+ # @option opts [Hash] filter The filters to apply
12
+ # @option opts [Integer] limit The limit to return
13
+ # @option opts [String] orderBy Parameter to sort by
14
+ # @option opts [String] orderDirection Direction of sort
15
+ # @return [array] top n mentioned_authors based on parameter passed
16
+ def data_mentioned_authors(project_id, opts = {})
17
+ get "/projects/#{project_id}/data/mentionedauthors", opts
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -31,7 +31,7 @@ module BWAPI
31
31
  patch "projects/#{project_id}/data/mentions", opts
32
32
  end
33
33
 
34
- # Get mentions that fall within the submitted filters with fulltext
34
+ # Get mentions that fall within the submitted filters with full text
35
35
  #
36
36
  # @param project_id [Integer] Id of project
37
37
  # @param opts [Hash] options hash of parameters
@@ -42,7 +42,7 @@ module BWAPI
42
42
  # @option opts [String] orderDirection Direction of sort
43
43
  # @option opts [Integer] orderByCategory Category to sort by when orderBy category
44
44
  # @return [Hash] All Mentions
45
- def data_mentions_fulltext(project_id, opts = {})
45
+ def data_mentions_full_text(project_id, opts = {})
46
46
  get "projects/#{project_id}/data/mentions/fulltext", opts
47
47
  end
48
48
 
@@ -61,6 +61,36 @@ module BWAPI
61
61
  get "projects/#{project_id}/data/mentions/tweets", opts
62
62
  end
63
63
 
64
+ # Get mentions that fall within the submitted filters for all facebook posts
65
+ #
66
+ # @param project_id [Integer] Id of project
67
+ # @param opts [Hash] options hash of parameters
68
+ # @option opts [Hash] filter The filters to apply
69
+ # @option opts [Integer] page Page of projects to retrieve
70
+ # @option opts [Integer] pageSize Results per page of results
71
+ # @option opts [String] orderBy Parameter to sort by
72
+ # @option opts [String] orderDirection Direction of sort
73
+ # @option opts [Integer] orderByCategory Category to sort by when orderBy category
74
+ # @return [Hash] All Mentions
75
+ def data_mentions_facebook_posts(project_id, opts = {})
76
+ get "projects/#{project_id}/data/mentions/facebookposts", opts
77
+ end
78
+
79
+ # Get mentions that fall within the submitted filters for all facebook comments
80
+ #
81
+ # @param project_id [Integer] Id of project
82
+ # @param opts [Hash] options hash of parameters
83
+ # @option opts [Hash] filter The filters to apply
84
+ # @option opts [Integer] page Page of projects to retrieve
85
+ # @option opts [Integer] pageSize Results per page of results
86
+ # @option opts [String] orderBy Parameter to sort by
87
+ # @option opts [String] orderDirection Direction of sort
88
+ # @option opts [Integer] orderByCategory Category to sort by when orderBy category
89
+ # @return [Hash] All Mentions
90
+ def data_mentions_facebook_comments(project_id, opts = {})
91
+ get "projects/#{project_id}/data/mentions/facebookcomments", opts
92
+ end
93
+
64
94
  include BWAPI::Client::Projects::Data::Mentions::Notes
65
95
  end
66
96
  end
@@ -0,0 +1,21 @@
1
+ module BWAPI
2
+ class Client
3
+ module Projects
4
+ module Data
5
+ # OwnerActivity module for projects/data/ownerActivity endpoints
6
+ module OwnerActivity
7
+ # Get all owner activity data for queries broken down by a second dimension
8
+ #
9
+ # @param project_id [Integer] Id of project
10
+ # @param dimension_two [String] Dimension 2 value
11
+ # @param opts [Hash] options hash of parameters
12
+ # @option opts [Hash] filter The filters to apply
13
+ # @return [Hash] All data owner activity queries mentions
14
+ def data_owner_activity_queries(project_id, dimension_two, opts = {})
15
+ get "projects/#{project_id}/data/ownerActivity/queries/#{dimension_two}", opts
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,23 @@
1
+ module BWAPI
2
+ class Client
3
+ module Projects
4
+ module Data
5
+ # Urls module for the /projects/{project_id}/data/urls endpoint
6
+ module Urls
7
+ # Get top n urls
8
+ #
9
+ # @param project_id [Integer] Id of project
10
+ # @param opts [Hash] options hash of parameters
11
+ # @option opts [Hash] filter The filters to apply
12
+ # @option opts [Integer] limit The limit to return
13
+ # @option opts [String] orderBy Parameter to sort by
14
+ # @option opts [String] orderDirection Direction of sort
15
+ # @return [array] top n twitter urls based on parameter passed
16
+ def data_urls(project_id, opts = {})
17
+ get "/projects/#{project_id}/data/urls", opts
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end