Class: Twilio::REST::Oauth::V1::TokenInstance

Inherits:
InstanceResource show all
Defined in:
lib/twilio-ruby/rest/oauth/v1/token.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, payload) ⇒ TokenInstance

Initialize the TokenInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio



99
100
101
102
103
104
105
106
107
108
109
110
# File 'lib/twilio-ruby/rest/oauth/v1/token.rb', line 99

def initialize(version, payload)
  super(version)

  # Marshaled Properties
  @properties = {
      'access_token' => payload['access_token'],
      'refresh_token' => payload['refresh_token'],
      'id_token' => payload['id_token'],
      'refresh_token_expires_at' => Twilio.deserialize_iso8601_datetime(payload['refresh_token_expires_at']),
      'access_token_expires_at' => Twilio.deserialize_iso8601_datetime(payload['access_token_expires_at']),
  }
end

Instance Method Details

#access_tokenString

Returns Token which carries the necessary information to access a Twilio resource directly.

Returns:

  • (String)

    Token which carries the necessary information to access a Twilio resource directly



114
115
116
# File 'lib/twilio-ruby/rest/oauth/v1/token.rb', line 114

def access_token
  @properties['access_token']
end

#access_token_expires_atTime

Returns The RFC 2822 date and time in GMT when the access token expires.

Returns:

  • (Time)

    The RFC 2822 date and time in GMT when the access token expires



138
139
140
# File 'lib/twilio-ruby/rest/oauth/v1/token.rb', line 138

def access_token_expires_at
  @properties['access_token_expires_at']
end

#id_tokenString

Returns The id_token.

Returns:

  • (String)

    The id_token



126
127
128
# File 'lib/twilio-ruby/rest/oauth/v1/token.rb', line 126

def id_token
  @properties['id_token']
end

#inspectObject

Provide a detailed, user friendly representation



150
151
152
# File 'lib/twilio-ruby/rest/oauth/v1/token.rb', line 150

def inspect
  "<Twilio.Oauth.V1.TokenInstance>"
end

#refresh_tokenString

Returns Token which carries the information necessary to get a new access token.

Returns:

  • (String)

    Token which carries the information necessary to get a new access token



120
121
122
# File 'lib/twilio-ruby/rest/oauth/v1/token.rb', line 120

def refresh_token
  @properties['refresh_token']
end

#refresh_token_expires_atTime

Returns The RFC 2822 date and time in GMT when the refresh token expires.

Returns:

  • (Time)

    The RFC 2822 date and time in GMT when the refresh token expires



132
133
134
# File 'lib/twilio-ruby/rest/oauth/v1/token.rb', line 132

def refresh_token_expires_at
  @properties['refresh_token_expires_at']
end

#to_sObject

Provide a user friendly representation



144
145
146
# File 'lib/twilio-ruby/rest/oauth/v1/token.rb', line 144

def to_s
  "<Twilio.Oauth.V1.TokenInstance>"
end