Class: Twilio::REST::Verify::V2::ServiceContext::AccessTokenInstance

Inherits:
InstanceResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/verify/v2/service/access_token.rb

Overview

PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, service_sid: nil, sid: nil) ⇒ AccessTokenInstance

Initialize the AccessTokenInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • service_sid (String) (defaults to: nil)

    The unique SID identifier of the Verify Service.

  • sid (String) (defaults to: nil)

    A 34 character string that uniquely identifies this Access Token.


151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# File 'lib/twilio-ruby/rest/verify/v2/service/access_token.rb', line 151

def initialize(version, payload, service_sid: nil, sid: nil)
  super(version)

  # Marshaled Properties
  @properties = {
      'sid' => payload['sid'],
      'account_sid' => payload['account_sid'],
      'service_sid' => payload['service_sid'],
      'entity_identity' => payload['entity_identity'],
      'factor_type' => payload['factor_type'],
      'factor_friendly_name' => payload['factor_friendly_name'],
      'token' => payload['token'],
      'url' => payload['url'],
      'ttl' => payload['ttl'].to_i,
      'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
  }

  # Context
  @instance_context = nil
  @params = {'service_sid' => service_sid, 'sid' => sid || @properties['sid'], }
end

Instance Method Details

#account_sidString

Returns Account Sid.

Returns:

  • (String)

    Account Sid.


192
193
194
# File 'lib/twilio-ruby/rest/verify/v2/service/access_token.rb', line 192

def 
  @properties['account_sid']
end

#contextAccessTokenContext

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context

Returns:


177
178
179
180
181
182
# File 'lib/twilio-ruby/rest/verify/v2/service/access_token.rb', line 177

def context
  unless @instance_context
    @instance_context = AccessTokenContext.new(@version, @params['service_sid'], @params['sid'], )
  end
  @instance_context
end

#date_createdTime

Returns The date this access token was created.

Returns:

  • (Time)

    The date this access token was created


240
241
242
# File 'lib/twilio-ruby/rest/verify/v2/service/access_token.rb', line 240

def date_created
  @properties['date_created']
end

#entity_identityString

Returns Unique external identifier of the Entity.

Returns:

  • (String)

    Unique external identifier of the Entity


204
205
206
# File 'lib/twilio-ruby/rest/verify/v2/service/access_token.rb', line 204

def entity_identity
  @properties['entity_identity']
end

#factor_friendly_nameString

Returns A human readable description of this factor.

Returns:

  • (String)

    A human readable description of this factor.


216
217
218
# File 'lib/twilio-ruby/rest/verify/v2/service/access_token.rb', line 216

def factor_friendly_name
  @properties['factor_friendly_name']
end

#factor_typeaccess_token.FactorTypes

Returns The Type of the Factor.

Returns:

  • (access_token.FactorTypes)

    The Type of the Factor


210
211
212
# File 'lib/twilio-ruby/rest/verify/v2/service/access_token.rb', line 210

def factor_type
  @properties['factor_type']
end

#fetchAccessTokenInstance

Fetch the AccessTokenInstance

Returns:


247
248
249
# File 'lib/twilio-ruby/rest/verify/v2/service/access_token.rb', line 247

def fetch
  context.fetch
end

#inspectObject

Provide a detailed, user friendly representation


260
261
262
263
# File 'lib/twilio-ruby/rest/verify/v2/service/access_token.rb', line 260

def inspect
  values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
  "<Twilio.Verify.V2.AccessTokenInstance #{values}>"
end

#service_sidString

Returns Verify Service Sid.

Returns:

  • (String)

    Verify Service Sid.


198
199
200
# File 'lib/twilio-ruby/rest/verify/v2/service/access_token.rb', line 198

def service_sid
  @properties['service_sid']
end

#sidString

Returns A string that uniquely identifies this Access Token.

Returns:

  • (String)

    A string that uniquely identifies this Access Token.


186
187
188
# File 'lib/twilio-ruby/rest/verify/v2/service/access_token.rb', line 186

def sid
  @properties['sid']
end

#to_sObject

Provide a user friendly representation


253
254
255
256
# File 'lib/twilio-ruby/rest/verify/v2/service/access_token.rb', line 253

def to_s
  values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
  "<Twilio.Verify.V2.AccessTokenInstance #{values}>"
end

#tokenString

Returns Generated access token.

Returns:

  • (String)

    Generated access token.


222
223
224
# File 'lib/twilio-ruby/rest/verify/v2/service/access_token.rb', line 222

def token
  @properties['token']
end

#ttlString

Returns How long, in seconds, the access token is valid.

Returns:

  • (String)

    How long, in seconds, the access token is valid.


234
235
236
# File 'lib/twilio-ruby/rest/verify/v2/service/access_token.rb', line 234

def ttl
  @properties['ttl']
end

#urlString

Returns The URL of this resource.

Returns:

  • (String)

    The URL of this resource.


228
229
230
# File 'lib/twilio-ruby/rest/verify/v2/service/access_token.rb', line 228

def url
  @properties['url']
end