class OmniAuth::Strategies::Ekuaishou
Public Instance Methods
raw_info()
click to toggle source
# File lib/omniauth/strategies/ekuaishou.rb, line 65 def raw_info @raw_info ||= begin resp = client.request(:get, "#{options.client_options[:site]}/rest/openapi/v1/advertiser/info", headers: headers, body: access_token.to_hash.slice('advertiser_id')) JSON.parse(resp.body)['data'] rescue {} end end
scope()
click to toggle source
# File lib/omniauth/strategies/ekuaishou.rb, line 72 def scope access_token['scope'] end
Protected Instance Methods
build_access_token()
click to toggle source
Calls superclass method
# File lib/omniauth/strategies/ekuaishou.rb, line 88 def build_access_token request.params['code'] = request.params['auth_code'] super end
client()
click to toggle source
Calls superclass method
# File lib/omniauth/strategies/ekuaishou.rb, line 78 def client _client = super _client.define_singleton_method(:request) do |verb, url, opts| super(verb, url, opts) do |req| req.body = req.body.to_json if req.body.is_a?(Hash) end end _client end
headers()
click to toggle source
# File lib/omniauth/strategies/ekuaishou.rb, line 103 def headers result = { 'Content-Type' => 'application/json' } result['Access-Token'] = access_token.token if access_token result end
token_params()
click to toggle source
Calls superclass method
# File lib/omniauth/strategies/ekuaishou.rb, line 93 def token_params super.merge( 'app_id' => client.id, 'secret' => client.secret, 'auth_code' => request.params['auth_code'], 'parse' => :json, 'headers' => headers ) end