Class: Twilio::REST::Oauth::V2::TokenInstance

Inherits:
InstanceResource show all
Defined in:
lib/twilio-ruby/rest/oauth/v2/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

  • account_sid (String)

    The SID of the Account that created this Token resource.

  • sid (String)

    The SID of the Call resource to fetch.



250
251
252
253
254
255
256
257
258
259
260
261
262
# File 'lib/twilio-ruby/rest/oauth/v2/token.rb', line 250

def initialize(version, payload )
    super(version)
    
    
    # Marshaled Properties
    @properties = { 
        'access_token' => payload['access_token'],
        'refresh_token' => payload['refresh_token'],
        'id_token' => payload['id_token'],
        'token_type' => payload['token_type'],
        'expires_in' => payload['expires_in'],
    }
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.



267
268
269
# File 'lib/twilio-ruby/rest/oauth/v2/token.rb', line 267

def access_token
    @properties['access_token']
end

#expires_inString

Returns:

  • (String)


291
292
293
# File 'lib/twilio-ruby/rest/oauth/v2/token.rb', line 291

def expires_in
    @properties['expires_in']
end

#id_tokenString

Returns Token which carries the information necessary of user profile.

Returns:

  • (String)

    Token which carries the information necessary of user profile.



279
280
281
# File 'lib/twilio-ruby/rest/oauth/v2/token.rb', line 279

def id_token
    @properties['id_token']
end

#inspectObject

Provide a detailed, user friendly representation



303
304
305
# File 'lib/twilio-ruby/rest/oauth/v2/token.rb', line 303

def inspect
    "<Twilio.Oauth.V2.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.



273
274
275
# File 'lib/twilio-ruby/rest/oauth/v2/token.rb', line 273

def refresh_token
    @properties['refresh_token']
end

#to_sObject

Provide a user friendly representation



297
298
299
# File 'lib/twilio-ruby/rest/oauth/v2/token.rb', line 297

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

#token_typeString

Returns Token type.

Returns:

  • (String)

    Token type



285
286
287
# File 'lib/twilio-ruby/rest/oauth/v2/token.rb', line 285

def token_type
    @properties['token_type']
end