Class: PaypalAPI::AccessToken Private
- Inherits:
-
Object
- Object
- PaypalAPI::AccessToken
- Defined in:
- lib/paypal-api/access_token.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
AccessToken object stores authorization string and its expire time.
Instance Attribute Summary collapse
-
#authorization_string ⇒ String
readonly
private
Authorization string.
-
#expires_at ⇒ Time
readonly
private
Time when access token request expires.
-
#requested_at ⇒ Time
readonly
private
Time when access token request was sent.
Instance Method Summary collapse
-
#expired? ⇒ Boolean
private
Shows if current AccessToken was expired.
-
#initialize(requested_at:, expires_in:, access_token:, token_type:) ⇒ AccessToken
constructor
private
Initializes AccessToken object.
-
#inspect ⇒ String
(also: #to_s)
private
Instance representation string.
Constructor Details
#initialize(requested_at:, expires_in:, access_token:, token_type:) ⇒ AccessToken
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Initializes AccessToken object
32 33 34 35 36 37 |
# File 'lib/paypal-api/access_token.rb', line 32 def initialize(requested_at:, expires_in:, access_token:, token_type:) @requested_at = requested_at @expires_at = requested_at + expires_in = "#{token_type} #{access_token}" freeze end |
Instance Attribute Details
#authorization_string ⇒ String (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Authorization string
20 21 22 |
# File 'lib/paypal-api/access_token.rb', line 20 def end |
#expires_at ⇒ Time (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Time when access token request expires
16 17 18 |
# File 'lib/paypal-api/access_token.rb', line 16 def expires_at @expires_at end |
#requested_at ⇒ Time (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Time when access token request was sent
12 13 14 |
# File 'lib/paypal-api/access_token.rb', line 12 def requested_at @requested_at end |
Instance Method Details
#expired? ⇒ Boolean
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Shows if current AccessToken was expired
42 43 44 |
# File 'lib/paypal-api/access_token.rb', line 42 def expired? Time.now >= expires_at end |
#inspect ⇒ String Also known as: to_s
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Instance representation string
51 52 53 |
# File 'lib/paypal-api/access_token.rb', line 51 def inspect "#<#{self.class.name} methods: (requested_at, expires_at, expired?, authorization_string)>" end |