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



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

#deleteBoolean

Delete the BucketInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



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

#fetchBucketInstance

Fetch the BucketInstance

Returns:



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

#inspectObject

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_sObject

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

Parameters:

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

Returns:



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