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.
-
#delete_with_metadata ⇒ Boolean
Delete the BucketInstanceMetadata.
-
#fetch ⇒ BucketInstance
Fetch the BucketInstance.
-
#fetch_with_metadata ⇒ BucketInstance
Fetch the BucketInstanceMetadata.
-
#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.
-
#update_with_metadata(rate_limit_request: :unset) ⇒ BucketInstance
Update the BucketInstanceMetadata.
Constructor Details
#initialize(version, field, bucket) ⇒ BucketContext
Initialize the BucketContext
68 69 70 71 72 73 74 75 76 77 |
# File 'lib/twilio-ruby/rest/lookups/v2/bucket.rb', line 68 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
81 82 83 84 85 86 87 88 89 |
# File 'lib/twilio-ruby/rest/lookups/v2/bucket.rb', line 81 def delete headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) @version.delete('DELETE', @uri, headers: headers) end |
#delete_with_metadata ⇒ Boolean
Delete the BucketInstanceMetadata
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/twilio-ruby/rest/lookups/v2/bucket.rb', line 94 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('DELETE', @uri, headers: headers) bucket_instance = BucketInstance.new( @version, response.body, account_sid: @solution[:account_sid], sid: @solution[:sid], ) BucketInstanceMetadata.new(@version, bucket_instance, response.headers, response.status_code) end |
#fetch ⇒ BucketInstance
Fetch the BucketInstance
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 113 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 |
#fetch_with_metadata ⇒ BucketInstance
Fetch the BucketInstanceMetadata
133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 |
# File 'lib/twilio-ruby/rest/lookups/v2/bucket.rb', line 133 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('GET', @uri, headers: headers) bucket_instance = BucketInstance.new( @version, response.body, field: @solution[:field], bucket: @solution[:bucket], ) BucketInstanceMetadata.new( @version, bucket_instance, response.headers, response.status_code ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
216 217 218 219 |
# File 'lib/twilio-ruby/rest/lookups/v2/bucket.rb', line 216 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Lookups.V2.BucketContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
209 210 211 212 |
# File 'lib/twilio-ruby/rest/lookups/v2/bucket.rb', line 209 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
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 |
# File 'lib/twilio-ruby/rest/lookups/v2/bucket.rb', line 160 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 |
#update_with_metadata(rate_limit_request: :unset) ⇒ BucketInstance
Update the BucketInstanceMetadata
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 |
# File 'lib/twilio-ruby/rest/lookups/v2/bucket.rb', line 182 def (rate_limit_request: :unset ) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) headers['Content-Type'] = 'application/json' response = @version.('PUT', @uri, headers: headers, data: rate_limit_request.to_json) bucket_instance = BucketInstance.new( @version, response.body, field: @solution[:field], bucket: @solution[:bucket], ) BucketInstanceMetadata.new( @version, bucket_instance, response.headers, response.status_code ) end |