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

  • service_sid (String) (defaults to: nil)

    The SID of the Service the resource is associated with.

  • sid (String) (defaults to: nil)

    The Twilio-provided string that uniquely identifies the Rate Limit resource to fetch.


258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
# File 'lib/twilio-ruby/rest/verify/v2/service/rate_limit.rb', line 258

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, 'sid' => sid || @properties['sid'], }
end

Instance Method Details

#account_sidString

Returns The SID of the Account that created the resource.

Returns:

  • (String)

    The SID of the Account that created the resource


304
305
306
# File 'lib/twilio-ruby/rest/verify/v2/service/rate_limit.rb', line 304

def 
  @properties['account_sid']
end

#bucketsbuckets

Access the buckets

Returns:


369
370
371
# File 'lib/twilio-ruby/rest/verify/v2/service/rate_limit.rb', line 369

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:


283
284
285
286
287
288
# File 'lib/twilio-ruby/rest/verify/v2/service/rate_limit.rb', line 283

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

#date_createdTime

Returns The RFC 2822 date and time in GMT when the resource was created.

Returns:

  • (Time)

    The RFC 2822 date and time in GMT when the resource was created


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

def date_created
  @properties['date_created']
end

#date_updatedTime

Returns The RFC 2822 date and time in GMT when the resource was last updated.

Returns:

  • (Time)

    The RFC 2822 date and time in GMT when the resource was last updated


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

def date_updated
  @properties['date_updated']
end

#deleteBoolean

Delete the RateLimitInstance

Returns:

  • (Boolean)

    true if delete succeeds, false otherwise


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

def delete
  context.delete
end

#descriptionString

Returns Description of this Rate Limit.

Returns:

  • (String)

    Description of this Rate Limit


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

def description
  @properties['description']
end

#fetchRateLimitInstance

Fetch the RateLimitInstance

Returns:


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

def fetch
  context.fetch
end

#inspectObject

Provide a detailed, user friendly representation


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

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

Returns The URLs of related resources.

Returns:

  • (String)

    The URLs of related resources


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

def links
  @properties['links']
end

#service_sidString

Returns The SID of the Service that the resource is associated with.

Returns:

  • (String)

    The SID of the Service that the resource is associated with


298
299
300
# File 'lib/twilio-ruby/rest/verify/v2/service/rate_limit.rb', line 298

def service_sid
  @properties['service_sid']
end

#sidString

Returns A string that uniquely identifies this Rate Limit.

Returns:

  • (String)

    A string that uniquely identifies this Rate Limit.


292
293
294
# File 'lib/twilio-ruby/rest/verify/v2/service/rate_limit.rb', line 292

def sid
  @properties['sid']
end

#to_sObject

Provide a user friendly representation


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

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

#unique_nameString

Returns A unique, developer assigned name of this Rate Limit.

Returns:

  • (String)

    A unique, developer assigned name of this Rate Limit.


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

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:


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

def update(description: :unset)
  context.update(description: description, )
end

#urlString

Returns The URL of this resource.

Returns:

  • (String)

    The URL of this resource.


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

def url
  @properties['url']
end