Class: OmniAuth::Strategies::Infinum

Inherits:
OAuth2
  • Object
show all
Defined in:
lib/omniauth/strategies/infinum.rb

Constant Summary collapse

@@url =
"http#{development_environment? ? '' : 's'}://accounts.infinum.co#{development_environment? ? '.dev' : ''}"

Instance Attribute Summary

Attributes inherited from OAuth2

#access_token

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from OAuth2

#authorize_params, #callback_phase, #callback_url, #client, #request_phase, #token_params

Class Method Details

.development_environment?Boolean

Returns:

  • (Boolean)


16
17
18
19
20
21
22
# File 'lib/omniauth/strategies/infinum.rb', line 16

def self.development_environment?
  if defined? Rails
    Rails.env.development?
  else
    ENV['RACK_ENV'].nil? || ENV['RACK_ENV'] == "development"
  end
end

.setup {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



26
27
28
29
30
31
32
33
34
# File 'lib/omniauth/strategies/infinum.rb', line 26

def self.setup
  yield self if block_given?

  option :client_options, {
    :site =>  @@url,
    :authorize_url => "#{@@url}/auth/infinum/authorize",
    :access_token_url => "#{@@url}/auth/infinum/access_token"
  }
end

.urlObject

mattr_accessor :url



8
9
10
# File 'lib/omniauth/strategies/infinum.rb', line 8

def self.url
  @@url
end

.url=(some_value) ⇒ Object



12
13
14
# File 'lib/omniauth/strategies/infinum.rb', line 12

def self.url=(some_value)
  @@url = some_value
end

Instance Method Details

#raw_infoObject



59
60
61
# File 'lib/omniauth/strategies/infinum.rb', line 59

def raw_info
  @raw_info ||= access_token.get("/auth/infinum/user.json?oauth_token=#{access_token.token}").parsed
end