Class: OmniAuth::Strategies::WePay
- Inherits:
-
OAuth2
- Object
- OAuth2
- OmniAuth::Strategies::WePay
show all
- Defined in:
- lib/omniauth/strategies/oauth2/we_pay.rb
Overview
OAuth 2.0 based authentication with WePay. In order to
sign up for an application, you need to register an application
and provide the proper credentials to this middleware.
Instance Attribute Summary
Attributes inherited from OAuth2
#client_id, #client_options, #client_secret, #options
Instance Method Summary
collapse
Methods inherited from OAuth2
#callback_url, #client
Constructor Details
#initialize(app, client_id = nil, client_secret = nil, options = {}, &block) ⇒ WePay
13
14
15
16
17
18
19
|
# File 'lib/omniauth/strategies/oauth2/we_pay.rb', line 13
def initialize(app, client_id=nil, client_secret=nil, options={}, &block)
client_options = {
:authorize_url => 'https://www.wepay.com/session/authorize',
:token_url => 'https://wepayapi.com/v1/oauth2/token',
}
super(app, :we_pay, client_id, client_secret, client_options, options, &block)
end
|
Instance Method Details
#auth_hash ⇒ Object
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/omniauth/strategies/oauth2/we_pay.rb', line 21
def auth_hash
OmniAuth::Utils.deep_merge(
super, {
'uid' => user_data['user_id'],
'user_info' => user_info,
'extra' => {
'user_hash' => user_data,
},
}
)
end
|
#user_data ⇒ Object
33
34
35
|
# File 'lib/omniauth/strategies/oauth2/we_pay.rb', line 33
def user_data
@data ||= MultiJson.decode(@access_token.get('/v1/user'))['result']
end
|
#user_info ⇒ Object
37
38
39
40
41
42
43
44
45
|
# File 'lib/omniauth/strategies/oauth2/we_pay.rb', line 37
def user_info
{
'email' => user_data['email'],
'name' => "#{user_data['firstName']} #{user_data['lastName']}".strip,
'first_name' => user_data['firstName'],
'last_name' => user_data['lastName'],
'image' => user_data['picture'],
}
end
|