class AdsCommonForBingAds::Auth::OAuth2Handler

Constants

OAUTH2_CONFIG_BING

Public Instance Methods

auth_string(credentials) click to toggle source
# File lib/ads_common_for_bing_ads/auth/oauth2_handler.rb, line 14
def auth_string(credentials)
  token = get_token(credentials)
  token[:access_token]
end

Private Instance Methods

create_client(credentials) click to toggle source
# File lib/ads_common_for_bing_ads/auth/oauth2_handler.rb, line 21
def create_client(credentials)
  oauth_options_bing = OAUTH2_CONFIG_BING.merge({
                                                    :client_id => credentials[:oauth2_client_id],
                                                    :client_secret => credentials[:oauth2_client_secret],
                                                    :scope => @scope,
                                                    :redirect_uri => credentials[:oauth2_callback] || DEFAULT_CALLBACK,
                                                    :state => credentials[:oauth2_state]
                                                }).reject {|k, v| v.nil?}
  return Signet::OAuth2::Client.new(oauth_options_bing)
end