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 that contains the resource

  • payload that contains response from Twilio

  • The SID of the Account that created this Bucket resource.

  • The SID of the Call resource to fetch.



368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
# File 'lib/twilio-ruby/rest/lookups/v2/bucket.rb', line 368

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

#bucketString

Returns Name of the bucket.

Returns:

  • Name of the bucket



439
440
441
# File 'lib/twilio-ruby/rest/lookups/v2/bucket.rb', line 439

def bucket
    @properties['bucket']
end

#codeString

Returns Twilio-specific error code.

Returns:

  • Twilio-specific error code



403
404
405
# File 'lib/twilio-ruby/rest/lookups/v2/bucket.rb', line 403

def code
    @properties['code']
end

#contextBucketContext

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

Returns:

  • CallContext for this CallInstance



394
395
396
397
398
399
# File 'lib/twilio-ruby/rest/lookups/v2/bucket.rb', line 394

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

#deleteBoolean

Delete the BucketInstance

Returns:

  • True if delete succeeds, false otherwise



458
459
460
461
# File 'lib/twilio-ruby/rest/lookups/v2/bucket.rb', line 458

def delete

    context.delete
end

#fetchBucketInstance

Fetch the BucketInstance

Returns:

  • Fetched BucketInstance



466
467
468
469
# File 'lib/twilio-ruby/rest/lookups/v2/bucket.rb', line 466

def fetch

    context.fetch
end

#fieldString

Returns Limit of requests for the bucket.

Returns:

  • Limit of requests for the bucket



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

def field
    @properties['field']
end

#inspectObject

Provide a detailed, user friendly representation



491
492
493
494
# File 'lib/twilio-ruby/rest/lookups/v2/bucket.rb', line 491

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

#limitString

Returns Limit of requests for the bucket.

Returns:

  • Limit of requests for the bucket



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

def limit
    @properties['limit']
end

#messageString

Returns Error message.

Returns:

  • Error message



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

def message
    @properties['message']
end

#more_infoString

Returns Link to Error Code References.

Returns:

  • Link to Error Code References



415
416
417
# File 'lib/twilio-ruby/rest/lookups/v2/bucket.rb', line 415

def more_info
    @properties['more_info']
end

#ownerString

Returns Owner of the rule.

Returns:

  • Owner of the rule



445
446
447
# File 'lib/twilio-ruby/rest/lookups/v2/bucket.rb', line 445

def owner
    @properties['owner']
end

#statusString

Returns HTTP response status code.

Returns:

  • HTTP response status code



421
422
423
# File 'lib/twilio-ruby/rest/lookups/v2/bucket.rb', line 421

def status
    @properties['status']
end

#to_sObject

Provide a user friendly representation



484
485
486
487
# File 'lib/twilio-ruby/rest/lookups/v2/bucket.rb', line 484

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

#ttlString

Returns Time to live of the rule.

Returns:

  • Time to live of the rule



451
452
453
# File 'lib/twilio-ruby/rest/lookups/v2/bucket.rb', line 451

def ttl
    @properties['ttl']
end

#update(rate_limit_request: :unset) ⇒ BucketInstance

Update the BucketInstance

Parameters:

  • (defaults to: :unset)

Returns:

  • Updated BucketInstance



475
476
477
478
479
480
# File 'lib/twilio-ruby/rest/lookups/v2/bucket.rb', line 475

def update(rate_limit_request: :unset
)

    context.update(
    )
end