Class: BWAPI::Client

Inherits:
Object
  • Object
show all
Includes:
Admin, Aggregates, Author, Brandwatch, Client, CommandCenter, Dimensions, ErrorCodes, Filters, Languages, Locations, Logout, Me, Metrics, OAuth, Ping, Projects, Public, QueryValidation, SSO, TestSearch, UsageSummary, User, Configuration, Connection, Performance, Request
Defined in:
lib/bwapi/client.rb,
lib/bwapi/client/me.rb,
lib/bwapi/client/sso.rb,
lib/bwapi/client/ping.rb,
lib/bwapi/client/user.rb,
lib/bwapi/client/admin.rb,
lib/bwapi/client/oauth.rb,
lib/bwapi/client/author.rb,
lib/bwapi/client/client.rb,
lib/bwapi/client/logout.rb,
lib/bwapi/client/public.rb,
lib/bwapi/client/filters.rb,
lib/bwapi/client/metrics.rb,
lib/bwapi/client/projects.rb,
lib/bwapi/client/languages.rb,
lib/bwapi/client/locations.rb,
lib/bwapi/client/aggregates.rb,
lib/bwapi/client/brandwatch.rb,
lib/bwapi/client/dimensions.rb,
lib/bwapi/client/error_codes.rb,
lib/bwapi/client/test_search.rb,
lib/bwapi/client/admin/become.rb,
lib/bwapi/client/admin/client.rb,
lib/bwapi/client/admin/search.rb,
lib/bwapi/client/admin/clients.rb,
lib/bwapi/client/projects/data.rb,
lib/bwapi/client/projects/tags.rb,
lib/bwapi/client/usage_summary.rb,
lib/bwapi/client/user/facebook.rb,
lib/bwapi/client/admin/projects.rb,
lib/bwapi/client/admin/reseller.rb,
lib/bwapi/client/command_center.rb,
lib/bwapi/client/projects/group.rb,
lib/bwapi/client/projects/rules.rb,
lib/bwapi/client/projects/users.rb,
lib/bwapi/client/projects/alerts.rb,
lib/bwapi/client/brandwatch/users.rb,
lib/bwapi/client/projects/queries.rb,
lib/bwapi/client/projects/sharing.rb,
lib/bwapi/client/projects/signals.rb,
lib/bwapi/client/projects/summary.rb,
lib/bwapi/client/query_validation.rb,
lib/bwapi/client/brandwatch/become.rb,
lib/bwapi/client/projects/research.rb,
lib/bwapi/client/projects/workflow.rb,
lib/bwapi/client/admin/demographics.rb,
lib/bwapi/client/admin/integrations.rb,
lib/bwapi/client/brandwatch/clients.rb,
lib/bwapi/client/client/sub_clients.rb,
lib/bwapi/client/projects/data/urls.rb,
lib/bwapi/client/user/notifications.rb,
lib/bwapi/client/admin/clients/users.rb,
lib/bwapi/client/projects/categories.rb,
lib/bwapi/client/projects/rules/copy.rb,
lib/bwapi/client/brandwatch/log_level.rb,
lib/bwapi/client/command_center/users.rb,
lib/bwapi/client/projects/data/volume.rb,
lib/bwapi/client/command_center/client.rb,
lib/bwapi/client/command_center/themes.rb,
lib/bwapi/client/projects/bulk_actions.rb,
lib/bwapi/client/projects/demographics.rb,
lib/bwapi/client/projects/queries/move.rb,
lib/bwapi/client/projects/query_groups.rb,
lib/bwapi/client/admin/pricing_upgrades.rb,
lib/bwapi/client/client/pricing_options.rb,
lib/bwapi/client/projects/data/audience.rb,
lib/bwapi/client/projects/data/hashtags.rb,
lib/bwapi/client/projects/data/mentions.rb,
lib/bwapi/client/projects/data_download.rb,
lib/bwapi/client/projects/ditto_queries.rb,
lib/bwapi/client/brandwatch/ditto_brands.rb,
lib/bwapi/client/brandwatch/usage_report.rb,
lib/bwapi/client/command_center/displays.rb,
lib/bwapi/client/command_center/projects.rb,
lib/bwapi/client/projects/data/emoticons.rb,
lib/bwapi/client/projects/data/headlines.rb,
lib/bwapi/client/projects/preview_search.rb,
lib/bwapi/client/projects/rules/backfill.rb,
lib/bwapi/client/projects/signals/groups.rb,
lib/bwapi/client/brandwatch/clients/users.rb,
lib/bwapi/client/projects/categories/copy.rb,
lib/bwapi/client/projects/twitter_queries.rb,
lib/bwapi/client/user/twitter_credentials.rb,
lib/bwapi/client/admin/clients/user_groups.rb,
lib/bwapi/client/brandwatch/command_center.rb,
lib/bwapi/client/projects/data/impressions.rb,
lib/bwapi/client/projects/decahose_queries.rb,
lib/bwapi/client/projects/facebook_queries.rb,
lib/bwapi/client/projects/group/site_group.rb,
lib/bwapi/client/projects/queries/backfill.rb,
lib/bwapi/client/projects/queries/mentions.rb,
lib/bwapi/client/brandwatch/clients/modules.rb,
lib/bwapi/client/command_center/scene_types.rb,
lib/bwapi/client/command_center/tag_colours.rb,
lib/bwapi/client/projects/instagram_queries.rb,
lib/bwapi/client/projects/query/mentionfind.rb,
lib/bwapi/client/projects/stream_dashboards.rb,
lib/bwapi/client/user/instagram_credentials.rb,
lib/bwapi/client/admin/clients/users/sharing.rb,
lib/bwapi/client/brandwatch/price_structures.rb,
lib/bwapi/client/command_center/users/access.rb,
lib/bwapi/client/projects/group/author_group.rb,
lib/bwapi/client/projects/queries/date_range.rb,
lib/bwapi/client/command_center/projects/data.rb,
lib/bwapi/client/command_center/query_colours.rb,
lib/bwapi/client/projects/bulk_actions/author.rb,
lib/bwapi/client/projects/data/mentions/notes.rb,
lib/bwapi/client/projects/data/owner_activity.rb,
lib/bwapi/client/command_center/colour_palette.rb,
lib/bwapi/client/command_center/display_access.rb,
lib/bwapi/client/command_center/displays/users.rb,
lib/bwapi/client/projects/data/channel_metrics.rb,
lib/bwapi/client/projects/group/location_group.rb,
lib/bwapi/client/command_center/displays/events.rb,
lib/bwapi/client/command_center/displays/scenes.rb,
lib/bwapi/client/projects/bulk_actions/mentions.rb,
lib/bwapi/client/command_center/category_colours.rb,
lib/bwapi/client/command_center/displays/screens.rb,
lib/bwapi/client/projects/data/audience_activity.rb,
lib/bwapi/client/projects/data/mentioned_authors.rb,
lib/bwapi/client/brandwatch/command_center/themes.rb,
lib/bwapi/client/command_center/displays/messages.rb,
lib/bwapi/client/brandwatch/clients/command_center.rb,
lib/bwapi/client/brandwatch/host_location_overrides.rb,
lib/bwapi/client/projects/stream_dashboards/streams.rb,
lib/bwapi/client/brandwatch/price_structures/clients.rb,
lib/bwapi/client/command_center/display_access/users.rb,
lib/bwapi/client/command_center/projects/tag_colours.rb,
lib/bwapi/client/command_center/displays/users/access.rb,
lib/bwapi/client/brandwatch/command_center/scene_types.rb,
lib/bwapi/client/brandwatch/clients/command_center/users.rb,
lib/bwapi/client/brandwatch/clients/command_center/limits.rb,
lib/bwapi/client/brandwatch/clients/command_center/themes.rb,
lib/bwapi/client/command_center/projects/category_colours.rb,
lib/bwapi/client/command_center/display_access/users/access.rb,
lib/bwapi/client/brandwatch/clients/command_center/scene_types.rb,
lib/bwapi/client/brandwatch/clients/command_center/users/access.rb

Overview

Client class to create BWAPI instances

Defined Under Namespace

Modules: Admin, Aggregates, Author, Brandwatch, Client, CommandCenter, Dimensions, ErrorCodes, Filters, Languages, Locations, Logout, Me, Metrics, OAuth, Ping, Projects, Public, QueryValidation, SSO, TestSearch, UsageSummary, User

Constant Summary

Constants included from Connection

BWAPI::Connection::RACK_BUILDER_CLASS

Instance Attribute Summary

Attributes included from Configuration

#access_token, #access_token_expiry, #adapter, #api_endpoint, #client_id, #debug, #grant_type, #logger, #open_timeout, #performance, #refresh_token, #timeout, #user_agent, #username, #verify_ssl

Instance Method Summary collapse

Methods included from User

#api_role, #change_password, #enable_two_factor_auth, #generate_two_factor_auth, #reset_password, #send_code, #send_reset_password_email, #ui_role, #update_user, #user, #user_spredfast, #verify_code

Methods included from User::TwitterCredentials

#delete_twitter_credentials, #twitter_credentials, #update_twitter_credentials

Methods included from User::Notifications

#create_notification, #notifications, #patch_notification, #update_notification

Methods included from User::InstagramCredentials

#delete_instagram_credentials, #instagram_credentials, #update_instagram_credentials

Methods included from User::Facebook

#facebook_issues

Methods included from UsageSummary

#reseller_client_usage_summary, #reseller_usage_summary

Methods included from TestSearch

#test_search_content

Methods included from SSO

#sso, #sso_user

Methods included from QueryValidation

#query_validation, #search_within

Methods included from Public

#public_signals_unsubscribe

Methods included from Projects

#copy_project, #create_project, #delete_project, #get_project, #project_twitter_audience_summary, #projects, #update_project

Methods included from Projects::Workflow

#workflow

Methods included from Projects::Users

#project_users

Methods included from Projects::TwitterQueries

#create_twitter_query, #delete_twitter_query, #get_twitter_query, #twitter_queries, #update_twitter_query

Methods included from Projects::Tags

#create_tag, #delete_tag, #get_tag, #tags, #update_tag

Methods included from Projects::Summary

#projects_summary

Methods included from Projects::StreamDashboards

#create_stream_dashboard, #delete_stream_dashboard, #get_stream_dashboard, #get_stream_dashboard_complete, #get_stream_dashboards_summary, #stream_dashboards, #update_stream_dashboard

Methods included from Projects::StreamDashboards::Streams

#create_stream, #delete_stream, #get_stream, #get_streams, #update_stream

Methods included from Projects::Signals::Groups

#create_signal_group, #delete_signal_group, #get_signal_group, #get_signal_group_signals, #signal_groups, #update_signal_group

Methods included from Projects::Sharing

#default_project_sharing, #project_sharing, #project_sharing_user, #update_project_sharing, #update_project_sharing_user

Methods included from Projects::Rules

#create_rule, #delete_rule, #get_rule, #rules, #update_rule

Methods included from Projects::Rules::Copy

#create_rule_copy

Methods included from Projects::Rules::Backfill

#create_rule_backfill

Methods included from Projects::Research

#get_research_projects, #update_research_projects

Methods included from Projects::QueryGroups

#create_query_group, #delete_query_group, #get_query_group, #query_groups, #update_query_group

Methods included from Projects::Query::MentionFind

#mention_find

Methods included from Projects::Queries

#create_query, #create_wizard_query, #delete_query, #get_query, #get_wizard_query, #queries, #queries_summary, #update_query, #update_wizard_query

Methods included from Projects::Queries::Move

#update_move

Methods included from Projects::Queries::Mentions

#delete_query_mention, #get_query_mention_content, #update_query_mention

Methods included from Projects::Queries::DateRange

#create_date_range, #date_ranges, #delete_date_range, #get_date_range, #update_date_range

Methods included from Projects::Queries::Backfill

#backfills, #create_backfill, #delete_backfill, #get_backfill

Methods included from Projects::PreviewSearch

#project_preview_search_author, #project_preview_search_dailymentions, #project_preview_search_history, #project_preview_search_mentions, #project_preview_search_site, #project_preview_search_topauthors, #project_preview_search_topic, #project_preview_search_topics, #project_preview_search_topsites

Methods included from Projects::InstagramQueries

#create_instagram_channel, #delete_instagram_channel, #get_instagram_channel, #instagram_channels, #update_instagram_channel

Methods included from Projects::Group::SiteGroup

#create_site_group, #delete_site_group, #get_site_group, #site_groups_summary, #update_site_group

Methods included from Projects::Group::LocationGroup

#create_location_group, #delete_location_group, #get_location_group, #location_groups_summary, #update_location_group

Methods included from Projects::Group::AuthorGroup

#author_groups_summary, #create_author_group, #delete_author_group, #get_author_group, #update_author_group

Methods included from Projects::FacebookQueries

#authorise_facebook_queries, #create_facebook_query, #delete_facebook_query, #facebook_queries, #get_facebook_query, #update_facebook_query

Methods included from Projects::DittoQueries

#create_ditto_query, #update_ditto_query

Methods included from Projects::DecahoseQueries

#create_decahose_query, #decahose_queries, #delete_decahose_query, #get_decahose_query, #update_decahose_query

Methods included from Projects::Demographics

#demographics

Methods included from Projects::DataDownload

#create_data_download, #data_downloads, #get_data_download

Methods included from Projects::Data

#data, #data_headlines

Methods included from Projects::Data::Volume

#data_volume_date_ranges_days, #data_volume_queries_top_sites, #data_volume_top_authors_queries, #data_volume_top_facebook_users_queries, #data_volume_top_sites_queries, #data_volume_top_tweeters_queries, #data_volume_topics_compare, #data_volume_topics_queries

Methods included from Projects::Data::Urls

#data_urls

Methods included from Projects::Data::OwnerActivity

#data_owner_activity_queries

Methods included from Projects::Data::Mentions

#data_mentions, #data_mentions_count, #data_mentions_facebook_comments, #data_mentions_facebook_posts, #data_mentions_full_text, #data_mentions_tweets, #update_data_mentions

Methods included from Projects::Data::Mentions::Notes

#create_mention_note, #mention_note, #patch_mention_note, #update_mention_note

Methods included from Projects::Data::MentionedAuthors

#data_mentioned_authors

Methods included from Projects::Data::Impressions

#data_impressions_queries

Methods included from Projects::Data::Headlines

#data_headlines

Methods included from Projects::Data::Hashtags

#data_hashtags

Methods included from Projects::Data::Emoticons

#data_emoticons

Methods included from Projects::Data::ChannelMetrics

#data_channel_metrics_queries

Methods included from Projects::Data::AudienceActivity

#data_audience_activity_queries

Methods included from Projects::Data::Audience

#data_audience_queries

Methods included from Projects::Categories

#categories, #create_category, #delete_category, #update_category

Methods included from Projects::Categories::Copy

#copy_category

Methods included from Projects::BulkActions

#bulk_actions

Methods included from Projects::BulkActions::Author

#bulk_edit_author

Methods included from Projects::BulkActions::Mentions

#bulk_delete_mentions, #bulk_edit_mentions

Methods included from Projects::Alerts

#alerts, #create_alert, #get_alert, #update_alert

Methods included from Ping

#create_ping, #delete_ping, #get_ping, #patch_ping, #update_ping

Methods included from OAuth

#determine_grant_type, #oauth_refresh_token, #oauth_request, #oauth_token

Methods included from Metrics

#metrics

Methods included from Me

#me, #user_client_id, #user_client_name, #user_id

Methods included from Logout

#logout

Methods included from Locations

#location, #locations

Methods included from Languages

#languages

Methods included from Filters

#filters

Methods included from ErrorCodes

#error_codes

Methods included from Dimensions

#dimensions

Methods included from CommandCenter::Users

#delete_user_access_level, #get_user_access_level, #users_access_levels

Methods included from CommandCenter::Users::Access

#update_user_access_level

Methods included from CommandCenter::Themes

#themes

Methods included from CommandCenter::TagColours

#all_tag_colours

Methods included from CommandCenter::SceneTypes

#get_scene_type, #get_scene_type_with_sub_scenes, #scene_types

Methods included from CommandCenter::QueryColours

#create_query_colour, #delete_query_colour, #query_colours, #update_query_colour

Methods included from CommandCenter::Projects::TagColours

#create_tag_colour, #delete_tag_colour, #tag_colour, #tag_colours, #update_tag_colour

Methods included from CommandCenter::Projects::Data

#command_center_data

Methods included from CommandCenter::Projects::CategoryColours

#category_colour, #category_colours, #create_category_colour, #delete_category_colour, #update_category_colour

Methods included from CommandCenter::Displays

#create_display, #delete_display, #displays, #get_display, #update_display

Methods included from CommandCenter::Displays::Users

#delete_display_user_access_levels, #displays_access_levels, #get_display_user_access_levels, #get_display_users_access_levels, #get_displays_user_access_levels

Methods included from CommandCenter::Displays::Users::Access

#grant_display_user_access_level, #update_display_user_access_level

Methods included from CommandCenter::Displays::Screens

#create_screen, #delete_screen, #get_screen, #get_screen_with_scenes, #screens, #update_screen

Methods included from CommandCenter::Displays::Scenes

#create_scene, #delete_scene, #get_scene, #get_scene_with_sub_scenes, #scenes, #update_scene

Methods included from CommandCenter::Displays::Messages

#create_message, #delete_message, #get_message, #messages, #update_message

Methods included from CommandCenter::Displays::Events

#create_event, #delete_event, #events, #get_event, #update_event

Methods included from CommandCenter::DisplayAccess::Users::Access

#update_displays_user_access_level

Methods included from CommandCenter::ColourPalette

#colour_palette, #update_colour_palette

Methods included from CommandCenter::Client

#vizia_client

Methods included from CommandCenter::CategoryColours

#all_category_colours

Methods included from Client

#client, #client_modules, #client_pricing, #client_subclients, #client_usage

Methods included from Client::SubClients

#client_sub_clients, #create_client_sub_client, #delete_client_sub_client, #get_client_sub_client, #update_client_sub_client

Methods included from Client::PricingOptions

#pricing_options

Methods included from Brandwatch

#brandwatch_data_download, #delete_token_log_level, #get_token_log_level, #update_token_log_level

Methods included from Brandwatch::Users

#brandwatch_users_details

Methods included from Brandwatch::UsageReport

#brandwatch_usage_report

Methods included from Brandwatch::PriceStructures

#create_price_structure, #delete_price_structure, #get_client_price_structures, #get_price_structures

Methods included from Brandwatch::PriceStructures::Clients

#get_client_price_structures

Methods included from Brandwatch::LogLevel

#brandwatch_log_level

Methods included from Brandwatch::HostLocationOverrides

#get_host_location_override, #host_location_overrides

Methods included from Brandwatch::DittoBrands

#brandwatch_ditto_brands, #create_brandwatch_ditto_brand

Methods included from Brandwatch::CommandCenter::Themes

#brandwatch_theme_by_id, #brandwatch_theme_by_name, #brandwatch_themes, #create_brandwatch_theme, #delete_brandwatch_theme, #enabled_brandwatch_themes, #update_brandwatch_theme

Methods included from Brandwatch::CommandCenter::SceneTypes

#brandwatch_all_scene_types, #brandwatch_scene_type, #brandwatch_scene_type_with_sub_scenes

Methods included from Brandwatch::Clients

#brandwatch_clients, #brandwatch_create_client, #brandwatch_get_client, #brandwatch_update_client

Methods included from Brandwatch::Clients::Modules

#brandwatch_client_modules, #update_brandwatch_client_modules

Methods included from Brandwatch::Clients::Users

#brandwatch_create_client_user, #brandwatch_get_client_user, #brandwatch_get_client_users, #brandwatch_update_client_user

Methods included from Brandwatch::Clients::CommandCenter::Users

#brandwatch_user_access_level, #brandwatch_users_access_levels

Methods included from Brandwatch::Clients::CommandCenter::Users::Access

#brandwatch_delete_user_access_level, #brandwatch_update_user_access_level

Methods included from Brandwatch::Clients::CommandCenter::Themes

#brandwatch_client_create_themes, #brandwatch_client_delete_themes, #brandwatch_client_themes

Methods included from Brandwatch::Clients::CommandCenter::SceneTypes

#brandwatch_scene_types, #brandwatch_update_scene_type

Methods included from Brandwatch::Clients::CommandCenter::Limits

#brandwatch_create_vizia_limits, #brandwatch_update_vizia_limits, #brandwatch_vizia_limits

Methods included from Brandwatch::Become

#brandwatch_become

Methods included from Author

#author_interests, #author_professions, #get_author, #update_author

Methods included from Aggregates

#aggregates

Methods included from Admin

#active_queries, #sharing_report

Methods included from Admin::Projects

#lock_query, #unlock_query

Methods included from Admin::PricingUpgrades

#pricing_upgrades

Methods included from Admin::Search

#search_query_name, #search_query_text, #search_rule_text

Methods included from Admin::Reseller

#reseller_client_mention_usage_report, #reseller_mention_usage_report

Methods included from Admin::Integrations

#create_jwt_integration, #get_jwt_integrations

Methods included from Admin::Demographics

#classify_author

Methods included from Admin::Client

#usage_by_query

Methods included from Admin::Clients

#daily_usage, #login_report

Methods included from Admin::Clients::UserGroups

#client_user_groups, #create_client_user_group, #delete_client_user_group, #update_client_user_group

Methods included from Admin::Clients::Users

#client_users, #create_client_user, #get_client_user, #update_client_user

Methods included from Admin::Clients::Users::Sharing

#client_users_sharing, #update_client_users_sharing

Methods included from Admin::Become

#admin_become

Methods included from Performance

#average_response_time, #average_response_time_breakdown, #fastest_response, #response_paths, #slowest_response, #total_responses

Methods included from Request

#delete, #get, #patch, #post, #put

Methods included from Configuration

#configure, #destroy, keys, #reset

Constructor Details

#initialize(options = {}) ⇒ Client

Initializes Client



67
68
69
70
71
# File 'lib/bwapi/client.rb', line 67

def initialize(options = {})
  BWAPI::Configuration.keys.each do |key|
    instance_variable_set(:"@#{key}", options[key] || BWAPI.instance_variable_get(:"@#{key}"))
  end
end

Instance Method Details

#access_token=(value) ⇒ Object



109
110
111
112
# File 'lib/bwapi/client.rb', line 109

def access_token=(value)
  reset_connection
  @access_token = value
end

#access_token_expired?Boolean

Check is access token has expired

Returns:

  • (Boolean)

    access token expiry status



76
77
78
79
# File 'lib/bwapi/client.rb', line 76

def access_token_expired?
  return true if @access_token.nil? || @access_token_expiry.nil?
  seconds_until_access_token_expires <= 0
end

#api_client?Boolean

Check if user is a brandwatch-api-client type

Returns:

  • (Boolean)

    Application client status



98
99
100
# File 'lib/bwapi/client.rb', line 98

def api_client?
  @client_id == 'brandwatch-api-client' ? true : false
end

#api_endpoint=(value) ⇒ Object



114
115
116
117
# File 'lib/bwapi/client.rb', line 114

def api_endpoint=(value)
  reset_connection
  @api_endpoint = value
end

#api_super_admin_client?Boolean

Check if user is a brandwatch-api-superadmin-client type

Returns:

  • (Boolean)

    Application client status



105
106
107
# File 'lib/bwapi/client.rb', line 105

def api_super_admin_client?
  @client_id == 'brandwatch-api-superadmin-client' ? true : false
end

#application_client?Boolean

Check if user is a brandwatch-application-client type

Returns:

  • (Boolean)

    Application client status



91
92
93
# File 'lib/bwapi/client.rb', line 91

def application_client?
  @client_id == 'brandwatch-application-client' ? true : false
end

#authenticated?Boolean

Check if user is authenicated

Returns:

  • (Boolean)

    Authenticated status



84
85
86
# File 'lib/bwapi/client.rb', line 84

def authenticated?
  (@access_token && !access_token_expired?) ? true : false
end

#connection_options=(value) ⇒ Object



119
120
121
122
# File 'lib/bwapi/client.rb', line 119

def connection_options=(value)
  reset_connection
  @connection_options = value
end

#debug=(value) ⇒ Object



124
125
126
127
# File 'lib/bwapi/client.rb', line 124

def debug=(value)
  reset_connection
  @debug = value
end

#logger=(value) ⇒ Object



129
130
131
132
# File 'lib/bwapi/client.rb', line 129

def logger=(value)
  reset_connection
  @logger = value
end

#verify_ssl=(value) ⇒ Object



134
135
136
137
# File 'lib/bwapi/client.rb', line 134

def verify_ssl=(value)
  reset_connection
  @verify_ssl = value
end