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.



184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
# File 'lib/twilio-ruby/rest/lookups/v2/bucket.rb', line 184

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:

  • (String)

    Name of the bucket



254
255
256
# File 'lib/twilio-ruby/rest/lookups/v2/bucket.rb', line 254

def bucket
    @properties['bucket']
end

#codeString

Returns Twilio-specific error code.

Returns:

  • (String)

    Twilio-specific error code



218
219
220
# File 'lib/twilio-ruby/rest/lookups/v2/bucket.rb', line 218

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:



209
210
211
212
213
214
# File 'lib/twilio-ruby/rest/lookups/v2/bucket.rb', line 209

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

#deleteBoolean

Delete the BucketInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



273
274
275
276
# File 'lib/twilio-ruby/rest/lookups/v2/bucket.rb', line 273

def delete

    context.delete
end

#fetchBucketInstance

Fetch the BucketInstance

Returns:



281
282
283
284
# File 'lib/twilio-ruby/rest/lookups/v2/bucket.rb', line 281

def fetch

    context.fetch
end

#fieldString

Returns Limit of requests for the bucket.

Returns:

  • (String)

    Limit of requests for the bucket



242
243
244
# File 'lib/twilio-ruby/rest/lookups/v2/bucket.rb', line 242

def field
    @properties['field']
end

#inspectObject

Provide a detailed, user friendly representation



306
307
308
309
# File 'lib/twilio-ruby/rest/lookups/v2/bucket.rb', line 306

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:

  • (String)

    Limit of requests for the bucket



248
249
250
# File 'lib/twilio-ruby/rest/lookups/v2/bucket.rb', line 248

def limit
    @properties['limit']
end

#messageString

Returns Error message.

Returns:

  • (String)

    Error message



224
225
226
# File 'lib/twilio-ruby/rest/lookups/v2/bucket.rb', line 224

def message
    @properties['message']
end

#more_infoString

Returns Link to Error Code References.

Returns:

  • (String)

    Link to Error Code References



230
231
232
# File 'lib/twilio-ruby/rest/lookups/v2/bucket.rb', line 230

def more_info
    @properties['more_info']
end

#ownerString

Returns Owner of the rule.

Returns:

  • (String)

    Owner of the rule



260
261
262
# File 'lib/twilio-ruby/rest/lookups/v2/bucket.rb', line 260

def owner
    @properties['owner']
end

#statusString

Returns HTTP response status code.

Returns:

  • (String)

    HTTP response status code



236
237
238
# File 'lib/twilio-ruby/rest/lookups/v2/bucket.rb', line 236

def status
    @properties['status']
end

#to_sObject

Provide a user friendly representation



299
300
301
302
# File 'lib/twilio-ruby/rest/lookups/v2/bucket.rb', line 299

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:

  • (String)

    Time to live of the rule



266
267
268
# File 'lib/twilio-ruby/rest/lookups/v2/bucket.rb', line 266

def ttl
    @properties['ttl']
end

#update(rate_limit_request: :unset) ⇒ BucketInstance

Update the BucketInstance

Parameters:

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

Returns:



290
291
292
293
294
295
# File 'lib/twilio-ruby/rest/lookups/v2/bucket.rb', line 290

def update(rate_limit_request: :unset
)

    context.update(
    )
end