class Twilio::REST::Verify::V2::ServiceContext::RateLimitContext::BucketInstance
Public Class Methods
Initialize the BucketInstance
@param [Version] version Version
that contains the resource @param [Hash] payload payload that contains response from Twilio
@param [String] service_sid
The SID of the
{Service}[https://www.twilio.com/docs/verify/api/service] the resource is associated with.
@param [String] rate_limit_sid
The Twilio-provided string that uniquely
identifies the Rate Limit resource.
@param [String] sid A 34 character string that uniquely identifies this Bucket. @return [BucketInstance] BucketInstance
Twilio::REST::InstanceResource::new
# File lib/twilio-ruby/rest/verify/v2/service/rate_limit/bucket.rb 261 def initialize(version, payload, service_sid: nil, rate_limit_sid: nil, sid: nil) 262 super(version) 263 264 # Marshaled Properties 265 @properties = { 266 'sid' => payload['sid'], 267 'rate_limit_sid' => payload['rate_limit_sid'], 268 'service_sid' => payload['service_sid'], 269 'account_sid' => payload['account_sid'], 270 'max' => payload['max'].to_i, 271 'interval' => payload['interval'].to_i, 272 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']), 273 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']), 274 'url' => payload['url'], 275 } 276 277 # Context 278 @instance_context = nil 279 @params = { 280 'service_sid' => service_sid, 281 'rate_limit_sid' => rate_limit_sid, 282 'sid' => sid || @properties['sid'], 283 } 284 end
Public Instance Methods
@return [String] The SID of the Account that created the resource
# File lib/twilio-ruby/rest/verify/v2/service/rate_limit/bucket.rb 322 def account_sid 323 @properties['account_sid'] 324 end
Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context @return [BucketContext] BucketContext
for this BucketInstance
# File lib/twilio-ruby/rest/verify/v2/service/rate_limit/bucket.rb 290 def context 291 unless @instance_context 292 @instance_context = BucketContext.new( 293 @version, 294 @params['service_sid'], 295 @params['rate_limit_sid'], 296 @params['sid'], 297 ) 298 end 299 @instance_context 300 end
@return [Time] The RFC 2822 date and time in GMT when the resource was created
# File lib/twilio-ruby/rest/verify/v2/service/rate_limit/bucket.rb 340 def date_created 341 @properties['date_created'] 342 end
@return [Time] The RFC 2822 date and time in GMT when the resource was last updated
# File lib/twilio-ruby/rest/verify/v2/service/rate_limit/bucket.rb 346 def date_updated 347 @properties['date_updated'] 348 end
Delete the BucketInstance
@return [Boolean] true if delete succeeds, false otherwise
# File lib/twilio-ruby/rest/verify/v2/service/rate_limit/bucket.rb 376 def delete 377 context.delete 378 end
Fetch the BucketInstance
@return [BucketInstance] Fetched BucketInstance
# File lib/twilio-ruby/rest/verify/v2/service/rate_limit/bucket.rb 369 def fetch 370 context.fetch 371 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/verify/v2/service/rate_limit/bucket.rb 389 def inspect 390 values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") 391 "<Twilio.Verify.V2.BucketInstance #{values}>" 392 end
@return [String] Number of seconds that the rate limit will be enforced over.
# File lib/twilio-ruby/rest/verify/v2/service/rate_limit/bucket.rb 334 def interval 335 @properties['interval'] 336 end
@return [String] Max number of requests.
# File lib/twilio-ruby/rest/verify/v2/service/rate_limit/bucket.rb 328 def max 329 @properties['max'] 330 end
@return [String] Rate Limit Sid.
# File lib/twilio-ruby/rest/verify/v2/service/rate_limit/bucket.rb 310 def rate_limit_sid 311 @properties['rate_limit_sid'] 312 end
@return [String] The SID of the Service that the resource is associated with
# File lib/twilio-ruby/rest/verify/v2/service/rate_limit/bucket.rb 316 def service_sid 317 @properties['service_sid'] 318 end
@return [String] A string that uniquely identifies this Bucket.
# File lib/twilio-ruby/rest/verify/v2/service/rate_limit/bucket.rb 304 def sid 305 @properties['sid'] 306 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/verify/v2/service/rate_limit/bucket.rb 382 def to_s 383 values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") 384 "<Twilio.Verify.V2.BucketInstance #{values}>" 385 end
Update the BucketInstance
@param [String] max Maximum number of requests permitted in during the interval. @param [String] interval Number of seconds that the rate limit will be enforced
over.
@return [BucketInstance] Updated BucketInstance
# File lib/twilio-ruby/rest/verify/v2/service/rate_limit/bucket.rb 362 def update(max: :unset, interval: :unset) 363 context.update(max: max, interval: interval, ) 364 end
@return [String] The URL of this resource.
# File lib/twilio-ruby/rest/verify/v2/service/rate_limit/bucket.rb 352 def url 353 @properties['url'] 354 end