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, QueryValidation, SSO, TestSearch, 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/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/search.rb,
lib/bwapi/client/projects/data.rb,
lib/bwapi/client/projects/tags.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/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/workflow.rb,
lib/bwapi/client/admin/demographics.rb,
lib/bwapi/client/brandwatch/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/query_groups.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/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/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/admin/clients/sub_clients.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/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/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/projects/stream_dashboards/streams.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, QueryValidation, SSO, TestSearch, 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, #performance, #refresh_token, #user_agent, #username, #verify_ssl

Instance Method Summary collapse

Methods included from User

#api_role, #ui_role, #update_user, #user

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 TestSearch

#test_search_content

Methods included from SSO

#sso

Methods included from QueryValidation

#query_validation, #search_within

Methods included from Projects

#create_project, #delete_project, #get_project, #projects, #update_project

Methods included from Projects::Workflow

#workflow

Methods included from Projects::Users

#project_users

Methods included from Projects::TwitterQueries

#create_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

#signals

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::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, #delete_query, #get_query, #queries, #queries_summary, #update_query

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::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, #facebook_queries, #get_facebook_query, #update_facebook_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_authors_queries_alt, #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_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_edit_mentions

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

Methods included from Brandwatch

#brandwatch_data_download

Methods included from Brandwatch::UsageReport

#brandwatch_usage_report

Methods included from Brandwatch::PriceStructures

#create_price_structure, #delete_price_structure, #get_price_structures

Methods included from Brandwatch::LogLevel

#brandwatch_log_level

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

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_themes, #brandwatch_update_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::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::Clients::SubClients

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

Methods included from Admin::Search

#search_query_name, #search_query_text, #search_rule_text

Methods included from Admin::Demographics

#classify_author

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



62
63
64
65
66
# File 'lib/bwapi/client.rb', line 62

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



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

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



71
72
73
74
# File 'lib/bwapi/client.rb', line 71

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



93
94
95
# File 'lib/bwapi/client.rb', line 93

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

#api_endpoint=(value) ⇒ Object



102
103
104
105
# File 'lib/bwapi/client.rb', line 102

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

#application_client?Boolean

Check if user is a brandwatch-application-client type

Returns:

  • (Boolean)

    Application client status



86
87
88
# File 'lib/bwapi/client.rb', line 86

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

#authenticated?Boolean

Check if user is authenicated

Returns:

  • (Boolean)

    Authenticated status



79
80
81
# File 'lib/bwapi/client.rb', line 79

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

#connection_options=(value) ⇒ Object



107
108
109
110
# File 'lib/bwapi/client.rb', line 107

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

#debug=(value) ⇒ Object



112
113
114
115
# File 'lib/bwapi/client.rb', line 112

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

#logger=(value) ⇒ Object



117
118
119
120
# File 'lib/bwapi/client.rb', line 117

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

#verify_ssl=(value) ⇒ Object



122
123
124
125
# File 'lib/bwapi/client.rb', line 122

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