Class: OAuthToken

Inherits:
Struct
  • Object
show all
Defined in:
lib/vhx/oauth_token.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}, refreshed = false) ⇒ OAuthToken

Returns a new instance of OAuthToken.


2
3
4
5
6
7
8
9
10
# File 'lib/vhx/oauth_token.rb', line 2

def initialize(params = {}, refreshed = false)
  params             = Hash[params.map{ |k, v| [k.to_sym, v] }]
  self.access_token  = params[:access_token]
  self.refresh_token = params[:refresh_token]
  self.expires_at    = params[:expires_at] || Time.now.to_i + params[:expires_in].to_i
  self.expires_in    = params[:expires_in]
  self.expires       = (params[:expires_at] || params[:expires_in]) ? true : false
  self.refreshed     = refreshed
end

Instance Attribute Details

#access_tokenObject

Returns the value of attribute access_token

Returns:

  • (Object)

    the current value of access_token


1
2
3
# File 'lib/vhx/oauth_token.rb', line 1

def access_token
  @access_token
end

#expiresObject

Returns the value of attribute expires

Returns:

  • (Object)

    the current value of expires


1
2
3
# File 'lib/vhx/oauth_token.rb', line 1

def expires
  @expires
end

#expires_atObject

Returns the value of attribute expires_at

Returns:

  • (Object)

    the current value of expires_at


1
2
3
# File 'lib/vhx/oauth_token.rb', line 1

def expires_at
  @expires_at
end

#expires_inObject

Returns the value of attribute expires_in

Returns:

  • (Object)

    the current value of expires_in


1
2
3
# File 'lib/vhx/oauth_token.rb', line 1

def expires_in
  @expires_in
end

#refresh_tokenObject

Returns the value of attribute refresh_token

Returns:

  • (Object)

    the current value of refresh_token


1
2
3
# File 'lib/vhx/oauth_token.rb', line 1

def refresh_token
  @refresh_token
end

#refreshedObject

Returns the value of attribute refreshed

Returns:

  • (Object)

    the current value of refreshed


1
2
3
# File 'lib/vhx/oauth_token.rb', line 1

def refreshed
  @refreshed
end