Class: PayPal::AccessToken

Inherits:
Object
  • Object
show all
Defined in:
lib/paypal/access_token.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ AccessToken

Returns a new instance of AccessToken.



7
8
9
10
11
12
# File 'lib/paypal/access_token.rb', line 7

def initialize(options)
  @access_token = options.access_token
  @token_type = options.token_type
  @expires_in = options.expires_in
  @date_created = Time.zone.now
end

Instance Attribute Details

#access_tokenObject

Returns the value of attribute access_token.



5
6
7
# File 'lib/paypal/access_token.rb', line 5

def access_token
  @access_token
end

#date_createdObject

Returns the value of attribute date_created.



5
6
7
# File 'lib/paypal/access_token.rb', line 5

def date_created
  @date_created
end

#expires_inObject

Returns the value of attribute expires_in.



5
6
7
# File 'lib/paypal/access_token.rb', line 5

def expires_in
  @expires_in
end

#token_typeObject

Returns the value of attribute token_type.



5
6
7
# File 'lib/paypal/access_token.rb', line 5

def token_type
  @token_type
end

Instance Method Details

#authorization_stringObject



18
19
20
# File 'lib/paypal/access_token.rb', line 18

def authorization_string
  "#{@token_type} #{@access_token}"
end

#expired?Boolean

Returns:

  • (Boolean)


14
15
16
# File 'lib/paypal/access_token.rb', line 14

def expired?
  Time.zone.now > @date_created + @expires_in
end