Class: Twilio::REST::Lookups::V2::BucketContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Lookups::V2::BucketContext
- Defined in:
- lib/twilio-ruby/rest/lookups/v2/bucket.rb
Instance Method Summary collapse
-
#delete ⇒ Boolean
Delete the BucketInstance.
-
#fetch ⇒ BucketInstance
Fetch the BucketInstance.
-
#initialize(version, field, bucket) ⇒ BucketContext
constructor
Initialize the BucketContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(rate_limit_request: :unset) ⇒ BucketInstance
Update the BucketInstance.
Constructor Details
#initialize(version, field, bucket) ⇒ BucketContext
Initialize the BucketContext
67 68 69 70 71 72 73 74 75 |
# File 'lib/twilio-ruby/rest/lookups/v2/bucket.rb', line 67 def initialize(version, field, bucket) super(version) # Path Solution @solution = { field: field, bucket: bucket, } @uri = "/RateLimits/Fields/#{@solution[:field]}/Bucket/#{@solution[:bucket]}" end |
Instance Method Details
#delete ⇒ Boolean
Delete the BucketInstance
79 80 81 82 83 84 85 86 |
# File 'lib/twilio-ruby/rest/lookups/v2/bucket.rb', line 79 def delete headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) @version.delete('DELETE', @uri, headers: headers) end |
#fetch ⇒ BucketInstance
Fetch the BucketInstance
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/twilio-ruby/rest/lookups/v2/bucket.rb', line 91 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) BucketInstance.new( @version, payload, field: @solution[:field], bucket: @solution[:bucket], ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
140 141 142 143 |
# File 'lib/twilio-ruby/rest/lookups/v2/bucket.rb', line 140 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Lookups.V2.BucketContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
133 134 135 136 |
# File 'lib/twilio-ruby/rest/lookups/v2/bucket.rb', line 133 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Lookups.V2.BucketContext #{context}>" end |
#update(rate_limit_request: :unset) ⇒ BucketInstance
Update the BucketInstance
112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'lib/twilio-ruby/rest/lookups/v2/bucket.rb', line 112 def update(rate_limit_request: :unset ) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) headers['Content-Type'] = 'application/json' payload = @version.update('PUT', @uri, headers: headers, data: rate_limit_request.to_json) BucketInstance.new( @version, payload, field: @solution[:field], bucket: @solution[:bucket], ) end |