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

  • account_sid (String) —

    The SID of the Account that created this Token resource.

  • sid (String) —

    The SID of the Call resource to fetch.



181
182
183
184
185
186
187
188
189
190
191
192
193
# File 'lib/twilio-ruby/rest/oauth/v1/token.rb', line 181

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_token ⇒ String

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.



198
199
200
# File 'lib/twilio-ruby/rest/oauth/v1/token.rb', line 198

def access_token
    @properties['access_token']
end

#expires_in ⇒ String

Returns:

  • (String)


222
223
224
# File 'lib/twilio-ruby/rest/oauth/v1/token.rb', line 222

def expires_in
    @properties['expires_in']
end

#id_token ⇒ String

Returns Token which carries the information necessary of user profile.

Returns:

  • (String) —

    Token which carries the information necessary of user profile.



210
211
212
# File 'lib/twilio-ruby/rest/oauth/v1/token.rb', line 210

def id_token
    @properties['id_token']
end

#inspect ⇒ Object

Provide a detailed, user friendly representation



234
235
236
# File 'lib/twilio-ruby/rest/oauth/v1/token.rb', line 234

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

#refresh_token ⇒ String

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.



204
205
206
# File 'lib/twilio-ruby/rest/oauth/v1/token.rb', line 204

def refresh_token
    @properties['refresh_token']
end

#to_s ⇒ Object

Provide a user friendly representation



228
229
230
# File 'lib/twilio-ruby/rest/oauth/v1/token.rb', line 228

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

#token_type ⇒ String

Returns Token type.

Returns:

  • (String) —

    Token type



216
217
218
# File 'lib/twilio-ruby/rest/oauth/v1/token.rb', line 216

def token_type
    @properties['token_type']
end