Class: Twilio::REST::Verify::V2::ServiceContext::RateLimitContext::BucketInstance
- Inherits:
-
InstanceResource
- Object
- InstanceResource
- Twilio::REST::Verify::V2::ServiceContext::RateLimitContext::BucketInstance
- Defined in:
- lib/twilio-ruby/rest/verify/v2/service/rate_limit/bucket.rb
Overview
PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
Instance Method Summary collapse
-
#account_sid ⇒ String
The SID of the Account that created the resource.
-
#context ⇒ BucketContext
Generate an instance context for the instance, the context is capable of performing various actions.
-
#date_created ⇒ Time
The RFC 2822 date and time in GMT when the resource was created.
-
#date_updated ⇒ Time
The RFC 2822 date and time in GMT when the resource was last updated.
-
#delete ⇒ Boolean
Deletes the BucketInstance.
-
#fetch ⇒ BucketInstance
Fetch a BucketInstance.
-
#initialize(version, payload, service_sid: nil, rate_limit_sid: nil, sid: nil) ⇒ BucketInstance
constructor
Initialize the BucketInstance.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#interval ⇒ String
Number of seconds that the rate limit will be enforced over.
-
#max ⇒ String
Max number of requests.
-
#rate_limit_sid ⇒ String
Rate Limit Sid.
-
#service_sid ⇒ String
The SID of the Service that the resource is associated with.
-
#sid ⇒ String
A string that uniquely identifies this Bucket.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(max: :unset, interval: :unset) ⇒ BucketInstance
Update the BucketInstance.
-
#url ⇒ String
The URL of this resource.
Constructor Details
#initialize(version, payload, service_sid: nil, rate_limit_sid: nil, sid: nil) ⇒ BucketInstance
Initialize the BucketInstance
286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 |
# File 'lib/twilio-ruby/rest/verify/v2/service/rate_limit/bucket.rb', line 286 def initialize(version, payload, service_sid: nil, rate_limit_sid: nil, sid: nil) super(version) # Marshaled Properties @properties = { 'sid' => payload['sid'], 'rate_limit_sid' => payload['rate_limit_sid'], 'service_sid' => payload['service_sid'], 'account_sid' => payload['account_sid'], 'max' => payload['max'].to_i, 'interval' => payload['interval'].to_i, 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']), 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']), 'url' => payload['url'], } # Context @instance_context = nil @params = { 'service_sid' => service_sid, 'rate_limit_sid' => rate_limit_sid, 'sid' => sid || @properties['sid'], } end |
Instance Method Details
#account_sid ⇒ String
Returns The SID of the Account that created the resource.
347 348 349 |
# File 'lib/twilio-ruby/rest/verify/v2/service/rate_limit/bucket.rb', line 347 def account_sid @properties['account_sid'] 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
315 316 317 318 319 320 321 322 323 324 325 |
# File 'lib/twilio-ruby/rest/verify/v2/service/rate_limit/bucket.rb', line 315 def context unless @instance_context @instance_context = BucketContext.new( @version, @params['service_sid'], @params['rate_limit_sid'], @params['sid'], ) end @instance_context end |
#date_created ⇒ Time
Returns The RFC 2822 date and time in GMT when the resource was created.
365 366 367 |
# File 'lib/twilio-ruby/rest/verify/v2/service/rate_limit/bucket.rb', line 365 def date_created @properties['date_created'] end |
#date_updated ⇒ Time
Returns The RFC 2822 date and time in GMT when the resource was last updated.
371 372 373 |
# File 'lib/twilio-ruby/rest/verify/v2/service/rate_limit/bucket.rb', line 371 def date_updated @properties['date_updated'] end |
#delete ⇒ Boolean
Deletes the BucketInstance
401 402 403 |
# File 'lib/twilio-ruby/rest/verify/v2/service/rate_limit/bucket.rb', line 401 def delete context.delete end |
#fetch ⇒ BucketInstance
Fetch a BucketInstance
394 395 396 |
# File 'lib/twilio-ruby/rest/verify/v2/service/rate_limit/bucket.rb', line 394 def fetch context.fetch end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
414 415 416 417 |
# File 'lib/twilio-ruby/rest/verify/v2/service/rate_limit/bucket.rb', line 414 def inspect values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Verify.V2.BucketInstance #{values}>" end |
#interval ⇒ String
Returns Number of seconds that the rate limit will be enforced over.
359 360 361 |
# File 'lib/twilio-ruby/rest/verify/v2/service/rate_limit/bucket.rb', line 359 def interval @properties['interval'] end |
#max ⇒ String
Returns Max number of requests.
353 354 355 |
# File 'lib/twilio-ruby/rest/verify/v2/service/rate_limit/bucket.rb', line 353 def max @properties['max'] end |
#rate_limit_sid ⇒ String
Returns Rate Limit Sid.
335 336 337 |
# File 'lib/twilio-ruby/rest/verify/v2/service/rate_limit/bucket.rb', line 335 def rate_limit_sid @properties['rate_limit_sid'] end |
#service_sid ⇒ String
Returns The SID of the Service that the resource is associated with.
341 342 343 |
# File 'lib/twilio-ruby/rest/verify/v2/service/rate_limit/bucket.rb', line 341 def service_sid @properties['service_sid'] end |
#sid ⇒ String
Returns A string that uniquely identifies this Bucket.
329 330 331 |
# File 'lib/twilio-ruby/rest/verify/v2/service/rate_limit/bucket.rb', line 329 def sid @properties['sid'] end |
#to_s ⇒ Object
Provide a user friendly representation
407 408 409 410 |
# File 'lib/twilio-ruby/rest/verify/v2/service/rate_limit/bucket.rb', line 407 def to_s values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Verify.V2.BucketInstance #{values}>" end |
#update(max: :unset, interval: :unset) ⇒ BucketInstance
Update the BucketInstance
387 388 389 |
# File 'lib/twilio-ruby/rest/verify/v2/service/rate_limit/bucket.rb', line 387 def update(max: :unset, interval: :unset) context.update(max: max, interval: interval, ) end |
#url ⇒ String
Returns The URL of this resource.
377 378 379 |
# File 'lib/twilio-ruby/rest/verify/v2/service/rate_limit/bucket.rb', line 377 def url @properties['url'] end |