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.



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

#bucket ⇒ String

Returns Name of the bucket.

Returns:

  • (String) —

    Name of the bucket



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

def bucket
    @properties['bucket']
end

#code ⇒ String

Returns Twilio-specific error code.

Returns:

  • (String) —

    Twilio-specific error code



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

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:



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

#delete ⇒ Boolean

Delete the BucketInstance

Returns:

  • (Boolean) —

    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

#fetch ⇒ BucketInstance

Fetch the BucketInstance

Returns:



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

def fetch

    context.fetch
end

#field ⇒ String

Returns Limit of requests for the bucket.

Returns:

  • (String) —

    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

#inspect ⇒ Object

Provide a detailed, user friendly representation



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

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



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

def limit
    @properties['limit']
end

#message ⇒ String

Returns Error message.

Returns:

  • (String) —

    Error message



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

def message
    @properties['message']
end

#more_info ⇒ String

Returns Link to Error Code References.

Returns:

  • (String) —

    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

#owner ⇒ String

Returns Owner of the rule.

Returns:

  • (String) —

    Owner of the rule



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

def owner
    @properties['owner']
end

#status ⇒ String

Returns HTTP response status code.

Returns:

  • (String) —

    HTTP response status code



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

def status
    @properties['status']
end

#to_s ⇒ Object

Provide a user friendly representation



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

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



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:

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

Returns:



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

def update(rate_limit_request: :unset
)

    context.update(
        rate_limit_request: rate_limit_request, 
    )
end