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.



119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/twilio-ruby/rest/oauth/v1/token.rb', line 119

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.



135
136
137
# File 'lib/twilio-ruby/rest/oauth/v1/token.rb', line 135

def access_token
    @properties['access_token']
end

#access_token_expires_atTime

Returns The date and time in GMT when the refresh token expires in [RFC 2822](www.ietf.org/rfc/rfc2822.txt) format.

Returns:



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

def access_token_expires_at
    @properties['access_token_expires_at']
end

#id_tokenString

Returns:

  • (String)


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

def id_token
    @properties['id_token']
end

#inspectObject

Provide a detailed, user friendly representation



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

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.



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

def refresh_token
    @properties['refresh_token']
end

#refresh_token_expires_atTime

Returns The date and time in GMT when the refresh token expires in [RFC 2822](www.ietf.org/rfc/rfc2822.txt) format.

Returns:



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

def refresh_token_expires_at
    @properties['refresh_token_expires_at']
end

#to_sObject

Provide a user friendly representation



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

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