Class: Twilio::REST::PreviewIam::V1::TokenInstance

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



126
127
128
129
130
131
132
133
134
135
136
137
# File 'lib/twilio-ruby/rest/preview_iam/v1/token.rb', line 126

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.



142
143
144
# File 'lib/twilio-ruby/rest/preview_iam/v1/token.rb', line 142

def access_token
    @properties['access_token']
end

#expires_inString

Returns:

  • (String)


166
167
168
# File 'lib/twilio-ruby/rest/preview_iam/v1/token.rb', line 166

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.



154
155
156
# File 'lib/twilio-ruby/rest/preview_iam/v1/token.rb', line 154

def id_token
    @properties['id_token']
end

#inspectObject

Provide a detailed, user friendly representation



178
179
180
# File 'lib/twilio-ruby/rest/preview_iam/v1/token.rb', line 178

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



148
149
150
# File 'lib/twilio-ruby/rest/preview_iam/v1/token.rb', line 148

def refresh_token
    @properties['refresh_token']
end

#to_sObject

Provide a user friendly representation



172
173
174
# File 'lib/twilio-ruby/rest/preview_iam/v1/token.rb', line 172

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

#token_typeString

Returns Token type.

Returns:

  • (String)

    Token type



160
161
162
# File 'lib/twilio-ruby/rest/preview_iam/v1/token.rb', line 160

def token_type
    @properties['token_type']
end