Class: OmniAuth::Strategies::Traycheckout

Inherits:
Object
  • Object
show all
Includes:
OmniAuth::Strategy
Defined in:
lib/omniauth/strategies/traycheckout.rb

Defined Under Namespace

Classes: CallbackError

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#access_tokenObject

Returns the value of attribute access_token.



23
24
25
# File 'lib/omniauth/strategies/traycheckout.rb', line 23

def access_token
  @access_token
end

Instance Method Details

#auth_hashObject



60
61
62
# File 'lib/omniauth/strategies/traycheckout.rb', line 60

def auth_hash
  self.credentials
end

#authorize_paramsObject



43
44
45
# File 'lib/omniauth/strategies/traycheckout.rb', line 43

def authorize_params
  { consumer_key: options.consumer_key }
end

#callback_phaseObject



51
52
53
54
55
56
57
58
# File 'lib/omniauth/strategies/traycheckout.rb', line 51

def callback_phase
  if request.params["code"].blank?
    fail!('code_blank', CallbackError.new(:code_blank, 'code can not be blank'))
  else
    self.access_token = build_access_token
    super
  end
end

#clientObject



25
26
27
28
29
# File 'lib/omniauth/strategies/traycheckout.rb', line 25

def client
  ::OAuth2::Client.new(options.consumer_key,
                       options.consumer_secret,
                       deep_symbolize(options.client_options))
end

#request_phaseObject



39
40
41
# File 'lib/omniauth/strategies/traycheckout.rb', line 39

def request_phase
  redirect client.authorize_url(authorize_params)
end

#token_paramsObject



47
48
49
# File 'lib/omniauth/strategies/traycheckout.rb', line 47

def token_params
  options.token_params.merge(options_for("token"))
end