Class: Twilio::REST::Lookups::V2::BucketInstance

Inherits:
InstanceResource show all
Defined in:
lib/twilio-ruby/rest/lookups/v2/bucket.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, field: nil, bucket: nil) ⇒ BucketInstance

Initialize the BucketInstance

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

  • sid (String) —

    The SID of the Call resource to fetch.



309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
# File 'lib/twilio-ruby/rest/lookups/v2/bucket.rb', line 309

def initialize(version, payload , field: nil, bucket: nil)
    super(version)
    
    
    # Marshaled Properties
    @properties = { 
        'code' => payload['code'],
        'message' => payload['message'],
        'more_info' => payload['more_info'],
        'status' => payload['status'],
        'field' => payload['field'],
        'limit' => payload['limit'],
        'bucket' => payload['bucket'],
        'owner' => payload['owner'],
        'ttl' => payload['ttl'],
    }

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

Instance Method Details

#bucket ⇒ String

Returns Name of the bucket.

Returns:

  • (String) —

    Name of the bucket



380
381
382
# File 'lib/twilio-ruby/rest/lookups/v2/bucket.rb', line 380

def bucket
    @properties['bucket']
end

#code ⇒ String

Returns Twilio-specific error code.

Returns:

  • (String) —

    Twilio-specific error code



344
345
346
# File 'lib/twilio-ruby/rest/lookups/v2/bucket.rb', line 344

def code
    @properties['code']
end

#context ⇒ BucketContext

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

Returns:



335
336
337
338
339
340
# File 'lib/twilio-ruby/rest/lookups/v2/bucket.rb', line 335

def context
    unless @instance_context
        @instance_context = BucketContext.new(@version , @params['field'], @params['bucket'])
    end
    @instance_context
end

#delete ⇒ Boolean

Delete the BucketInstance

Returns:

  • (Boolean) —

    True if delete succeeds, false otherwise



399
400
401
402
# File 'lib/twilio-ruby/rest/lookups/v2/bucket.rb', line 399

def delete

    context.delete
end

#fetch ⇒ BucketInstance

Fetch the BucketInstance

Returns:



407
408
409
410
# File 'lib/twilio-ruby/rest/lookups/v2/bucket.rb', line 407

def fetch

    context.fetch
end

#field ⇒ String

Returns Limit of requests for the bucket.

Returns:

  • (String) —

    Limit of requests for the bucket



368
369
370
# File 'lib/twilio-ruby/rest/lookups/v2/bucket.rb', line 368

def field
    @properties['field']
end

#inspect ⇒ Object

Provide a detailed, user friendly representation



433
434
435
436
# File 'lib/twilio-ruby/rest/lookups/v2/bucket.rb', line 433

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

#limit ⇒ String

Returns Limit of requests for the bucket.

Returns:

  • (String) —

    Limit of requests for the bucket



374
375
376
# File 'lib/twilio-ruby/rest/lookups/v2/bucket.rb', line 374

def limit
    @properties['limit']
end

#message ⇒ String

Returns Error message.

Returns:

  • (String) —

    Error message



350
351
352
# File 'lib/twilio-ruby/rest/lookups/v2/bucket.rb', line 350

def message
    @properties['message']
end

#more_info ⇒ String

Returns Link to Error Code References.

Returns:

  • (String) —

    Link to Error Code References



356
357
358
# File 'lib/twilio-ruby/rest/lookups/v2/bucket.rb', line 356

def more_info
    @properties['more_info']
end

#owner ⇒ String

Returns Owner of the rule.

Returns:

  • (String) —

    Owner of the rule



386
387
388
# File 'lib/twilio-ruby/rest/lookups/v2/bucket.rb', line 386

def owner
    @properties['owner']
end

#status ⇒ String

Returns HTTP response status code.

Returns:

  • (String) —

    HTTP response status code



362
363
364
# File 'lib/twilio-ruby/rest/lookups/v2/bucket.rb', line 362

def status
    @properties['status']
end

#to_s ⇒ Object

Provide a user friendly representation



426
427
428
429
# File 'lib/twilio-ruby/rest/lookups/v2/bucket.rb', line 426

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

#ttl ⇒ String

Returns Time to live of the rule.

Returns:

  • (String) —

    Time to live of the rule



392
393
394
# File 'lib/twilio-ruby/rest/lookups/v2/bucket.rb', line 392

def ttl
    @properties['ttl']
end

#update(rate_limit_request: :unset) ⇒ BucketInstance

Update the BucketInstance

Parameters:

  • rate_limit_request (RateLimitRequest) (defaults to: :unset)

Returns:



416
417
418
419
420
421
422
# File 'lib/twilio-ruby/rest/lookups/v2/bucket.rb', line 416

def update(rate_limit_request: :unset
)

    context.update(
        rate_limit_request: rate_limit_request, 
    )
end