Class: SmsCandy::Authentication::Strategies::OAuth2
- Inherits:
-
Object
- Object
- SmsCandy::Authentication::Strategies::OAuth2
- Defined in:
- lib/sms_candy/authentication/strategies/o_auth_2.rb
Instance Attribute Summary collapse
-
#access_token ⇒ Object
readonly
Returns the value of attribute access_token.
-
#expires_at ⇒ Object
readonly
Returns the value of attribute expires_at.
Instance Method Summary collapse
Instance Attribute Details
#access_token ⇒ Object (readonly)
Returns the value of attribute access_token.
8 9 10 |
# File 'lib/sms_candy/authentication/strategies/o_auth_2.rb', line 8 def access_token @access_token end |
#expires_at ⇒ Object (readonly)
Returns the value of attribute expires_at.
9 10 11 |
# File 'lib/sms_candy/authentication/strategies/o_auth_2.rb', line 9 def expires_at @expires_at end |
Instance Method Details
#authenticate! ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/sms_candy/authentication/strategies/o_auth_2.rb', line 16 def authenticate! response = RestClient.get(base_url, { params: authentication_params }) json_response = JSON.parse response.body @expires_at = Time.zone.now + json_response["expires_in"].to_i @access_token = json_response["access_token"] end |