Class: SynapseClient::RefreshedTokens
- Inherits:
-
Object
- Object
- SynapseClient::RefreshedTokens
- Defined in:
- lib/synapse_client/refreshed_tokens.rb
Instance Attribute Summary collapse
-
#new_access_token ⇒ Object
Returns the value of attribute new_access_token.
-
#new_expires_in ⇒ Object
Returns the value of attribute new_expires_in.
-
#new_refresh_token ⇒ Object
Returns the value of attribute new_refresh_token.
-
#old_access_token ⇒ Object
Returns the value of attribute old_access_token.
-
#old_refresh_token ⇒ Object
Returns the value of attribute old_refresh_token.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ RefreshedTokens
constructor
A new instance of RefreshedTokens.
- #refresh_old_tokens ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ RefreshedTokens
Returns a new instance of RefreshedTokens.
11 12 13 14 15 16 |
# File 'lib/synapse_client/refreshed_tokens.rb', line 11 def initialize( = {}) = Map.new() @old_access_token = [:old_access_token] @old_refresh_token = [:old_refresh_token] end |
Instance Attribute Details
#new_access_token ⇒ Object
Returns the value of attribute new_access_token.
7 8 9 |
# File 'lib/synapse_client/refreshed_tokens.rb', line 7 def new_access_token @new_access_token end |
#new_expires_in ⇒ Object
Returns the value of attribute new_expires_in.
9 10 11 |
# File 'lib/synapse_client/refreshed_tokens.rb', line 9 def new_expires_in @new_expires_in end |
#new_refresh_token ⇒ Object
Returns the value of attribute new_refresh_token.
8 9 10 |
# File 'lib/synapse_client/refreshed_tokens.rb', line 8 def new_refresh_token @new_refresh_token end |
#old_access_token ⇒ Object
Returns the value of attribute old_access_token.
5 6 7 |
# File 'lib/synapse_client/refreshed_tokens.rb', line 5 def old_access_token @old_access_token end |
#old_refresh_token ⇒ Object
Returns the value of attribute old_refresh_token.
6 7 8 |
# File 'lib/synapse_client/refreshed_tokens.rb', line 6 def old_refresh_token @old_refresh_token end |
Instance Method Details
#refresh_old_tokens ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/synapse_client/refreshed_tokens.rb', line 18 def refresh_old_tokens data = { :grant_type => "refresh_token", :refresh_token => @old_refresh_token } response = SynapseClient.request(:post, "/api/v2/user/refresh", data) unless response.instance_of?(SynapseClient::Error) @new_access_token = response.data["oauth_consumer_key"] @new_refresh_token = response.data["refresh_token"] @new_expires_in = response.data["expires_in"] return self else return response end end |