Class: Twilio::REST::Verify::V2::ServiceContext::RateLimitInstance

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

Instance Method Summary collapse

Constructor Details

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

Initialize the RateLimitInstance

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 RateLimit resource.

  • sid (String) (defaults to: nil)

    The SID of the Call resource to fetch.



284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
# File 'lib/twilio-ruby/rest/verify/v2/service/rate_limit.rb', line 284

def initialize(version, payload , service_sid: nil, sid: nil)
    super(version)
    
    # Marshaled Properties
    @properties = { 
        'sid' => payload['sid'],
        'service_sid' => payload['service_sid'],
        'account_sid' => payload['account_sid'],
        'unique_name' => payload['unique_name'],
        'description' => payload['description'],
        'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
        'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
        'url' => payload['url'],
        'links' => payload['links'],
    }

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

Instance Method Details

#account_sidString

Returns The SID of the [Account](www.twilio.com/docs/iam/api/account) that created the Rate Limit resource.

Returns:



330
331
332
# File 'lib/twilio-ruby/rest/verify/v2/service/rate_limit.rb', line 330

def 
    @properties['account_sid']
end

#bucketsbuckets

Access the buckets

Returns:



402
403
404
# File 'lib/twilio-ruby/rest/verify/v2/service/rate_limit.rb', line 402

def buckets
    context.buckets
end

#contextRateLimitContext

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

Returns:



309
310
311
312
313
314
# File 'lib/twilio-ruby/rest/verify/v2/service/rate_limit.rb', line 309

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

#date_createdTime

Returns The date and time in GMT when the resource was created specified in [RFC 2822](www.ietf.org/rfc/rfc2822.txt) format.

Returns:



348
349
350
# File 'lib/twilio-ruby/rest/verify/v2/service/rate_limit.rb', line 348

def date_created
    @properties['date_created']
end

#date_updatedTime

Returns The date and time in GMT when the resource was last updated specified in [RFC 2822](www.ietf.org/rfc/rfc2822.txt) format.

Returns:



354
355
356
# File 'lib/twilio-ruby/rest/verify/v2/service/rate_limit.rb', line 354

def date_updated
    @properties['date_updated']
end

#deleteBoolean

Delete the RateLimitInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



373
374
375
376
# File 'lib/twilio-ruby/rest/verify/v2/service/rate_limit.rb', line 373

def delete

    context.delete
end

#descriptionString

Returns Description of this Rate Limit.

Returns:

  • (String)

    Description of this Rate Limit



342
343
344
# File 'lib/twilio-ruby/rest/verify/v2/service/rate_limit.rb', line 342

def description
    @properties['description']
end

#fetchRateLimitInstance

Fetch the RateLimitInstance

Returns:



381
382
383
384
# File 'lib/twilio-ruby/rest/verify/v2/service/rate_limit.rb', line 381

def fetch

    context.fetch
end

#inspectObject

Provide a detailed, user friendly representation



415
416
417
418
# File 'lib/twilio-ruby/rest/verify/v2/service/rate_limit.rb', line 415

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

Returns The URLs of related resources.

Returns:

  • (Hash)

    The URLs of related resources.



366
367
368
# File 'lib/twilio-ruby/rest/verify/v2/service/rate_limit.rb', line 366

def links
    @properties['links']
end

#service_sidString

Returns The SID of the [Service](www.twilio.com/docs/verify/api/service) the resource is associated with.

Returns:



324
325
326
# File 'lib/twilio-ruby/rest/verify/v2/service/rate_limit.rb', line 324

def service_sid
    @properties['service_sid']
end

#sidString

Returns A 34 character string that uniquely identifies this Rate Limit.

Returns:

  • (String)

    A 34 character string that uniquely identifies this Rate Limit.



318
319
320
# File 'lib/twilio-ruby/rest/verify/v2/service/rate_limit.rb', line 318

def sid
    @properties['sid']
end

#to_sObject

Provide a user friendly representation



408
409
410
411
# File 'lib/twilio-ruby/rest/verify/v2/service/rate_limit.rb', line 408

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

#unique_nameString

Returns Provides a unique and addressable name to be assigned to this Rate Limit, assigned by the developer, to be optionally used in addition to SID. **This value should not contain PII.**.

Returns:

  • (String)

    Provides a unique and addressable name to be assigned to this Rate Limit, assigned by the developer, to be optionally used in addition to SID. **This value should not contain PII.**



336
337
338
# File 'lib/twilio-ruby/rest/verify/v2/service/rate_limit.rb', line 336

def unique_name
    @properties['unique_name']
end

#update(description: :unset) ⇒ RateLimitInstance

Update the RateLimitInstance

Parameters:

  • description (String) (defaults to: :unset)

    Description of this Rate Limit

Returns:



390
391
392
393
394
395
396
397
# File 'lib/twilio-ruby/rest/verify/v2/service/rate_limit.rb', line 390

def update(
    description: :unset
)

    context.update(
        description: description, 
    )
end

#urlString

Returns The URL of this resource.

Returns:

  • (String)

    The URL of this resource.



360
361
362
# File 'lib/twilio-ruby/rest/verify/v2/service/rate_limit.rb', line 360

def url
    @properties['url']
end