Class: SynapseClient::RefreshedTokens
- Inherits:
-
Object
- Object
- SynapseClient::RefreshedTokens
- Defined in:
- lib/synapse_client/refreshed_tokens.rb
Instance Attribute Summary collapse
-
#new_access_token ⇒ Object
readonly
Returns the value of attribute new_access_token.
-
#new_refresh_token ⇒ Object
readonly
Returns the value of attribute new_refresh_token.
-
#old_access_token ⇒ Object
readonly
Returns the value of attribute old_access_token.
-
#old_refresh_token ⇒ Object
readonly
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.
10 11 12 13 14 15 |
# File 'lib/synapse_client/refreshed_tokens.rb', line 10 def initialize( = {}) = Map.new() @old_access_token = [:old_access_token] @old_refresh_token = [:old_refresh_token] end |
Instance Attribute Details
#new_access_token ⇒ Object (readonly)
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_refresh_token ⇒ Object (readonly)
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 (readonly)
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 (readonly)
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
17 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 17 def refresh_old_tokens data = { :grant_type => "refresh_token", :refresh_token => @old_refresh_token } request = SynapseClient::Request.new("/oauth2/access_token", data) response = request.post unless response.instance_of?(SynapseClient::Error) self.new_access_token = response["access_token"] self.new_refresh_token = response["refresh_token"] return self else return response end end |