Class: Razorpay::OAuthToken
- Inherits:
-
Entity
- Object
- Entity
- Razorpay::OAuthToken
show all
- Defined in:
- lib/razorpay/oauth_token.rb
Overview
OAuth APIs allow to you create and manage access tokens
Instance Attribute Summary
Attributes inherited from Entity
#attributes
Class Method Summary
collapse
Methods inherited from Entity
#initialize, #method_missing, #respond_to_missing?, #to_json, #with_a_bang
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class Razorpay::Entity
Class Method Details
.get_access_token(options) ⇒ Object
33
34
35
36
37
|
# File 'lib/razorpay/oauth_token.rb', line 33
def self.get_access_token(options)
validate_access_token_request(options)
r = request
r.request :post, "/token", options
end
|
.get_auth_url(options) ⇒ Object
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/razorpay/oauth_token.rb', line 13
def self.get_auth_url(options)
validate_auth_url_request(options)
uri = URI.join(Razorpay::AUTH_URL, '/authorize')
query_params = {
'response_type' => 'code',
'client_id' => options['client_id'],
'redirect_uri' => options['redirect_uri'],
'state' => options['state']
}
options['scopes'].each { |scope| query_params["scope[]"] = scope }
if options.has_key?('onboarding_signature')
query_params['onboarding_signature'] = options['onboarding_signature']
end
uri.query = URI.encode_www_form(query_params)
uri.to_s
end
|
.refresh_token(options) ⇒ Object
39
40
41
42
43
44
|
# File 'lib/razorpay/oauth_token.rb', line 39
def self.refresh_token(options)
options['grant_type'] = 'refresh_token'
validate_refresh_token_request(options)
r = request
r.request :post, "/token", options
end
|
.revoke_token(options) ⇒ Object
46
47
48
49
50
|
# File 'lib/razorpay/oauth_token.rb', line 46
def self.revoke_token(options)
validate_revoke_token_request(options)
r = request
r.request :post, "/revoke", options
end
|