Class: Twilio::REST::Lookups::V2::BucketContext

Inherits:
InstanceContext show all
Defined in:
lib/twilio-ruby/rest/lookups/v2/bucket.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, field, bucket) ⇒ BucketContext

Initialize the BucketContext

Parameters:

  • version (Version)

    Version that contains the resource

  • field (String)

    field name

  • bucket (String)

    bucket name



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

#deleteBoolean

Delete the BucketInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



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_metadataBoolean

Delete the BucketInstanceMetadata

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



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],
      )
      .new(@version, bucket_instance, response.headers, response.status_code)
end

#fetchBucketInstance

Fetch the BucketInstance

Returns:



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_metadataBucketInstance

Fetch the BucketInstanceMetadata

Returns:



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],
    )
    .new(
        @version,
        bucket_instance,
        response.headers,
        response.status_code
    )
end

#inspectObject

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_sObject

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

Parameters:

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

Returns:



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

Parameters:

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

Returns:



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],
    )
    .new(
        @version,
        bucket_instance,
        response.headers,
        response.status_code
    )
end