Class: Twilio::REST::Wireless::V1::RatePlanContext

Inherits:
InstanceContext show all
Defined in:
lib/twilio-ruby/rest/wireless/v1/rate_plan.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, sid) ⇒ RatePlanContext

Initialize the RatePlanContext

Parameters:

  • version (Version)

    Version that contains the resource

  • sid (String)

    The SID of the RatePlan resource to update.



194
195
196
197
198
199
200
201
202
# File 'lib/twilio-ruby/rest/wireless/v1/rate_plan.rb', line 194

def initialize(version, sid)
    super(version)

    # Path Solution
    @solution = { sid: sid,  }
    @uri = "/RatePlans/#{@solution[:sid]}"

    
end

Instance Method Details

#deleteBoolean

Delete the RatePlanInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



206
207
208
209
210
211
212
213
# File 'lib/twilio-ruby/rest/wireless/v1/rate_plan.rb', line 206

def delete

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    @version.delete('DELETE', @uri, headers: headers)
end

#fetchRatePlanInstance

Fetch the RatePlanInstance

Returns:



218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
# File 'lib/twilio-ruby/rest/wireless/v1/rate_plan.rb', line 218

def fetch

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.fetch('GET', @uri, headers: headers)
    RatePlanInstance.new(
        @version,
        payload,
        sid: @solution[:sid],
    )
end

#inspectObject

Provide a detailed, user friendly representation



273
274
275
276
# File 'lib/twilio-ruby/rest/wireless/v1/rate_plan.rb', line 273

def inspect
    context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
    "#<Twilio.Wireless.V1.RatePlanContext #{context}>"
end

#to_sObject

Provide a user friendly representation



266
267
268
269
# File 'lib/twilio-ruby/rest/wireless/v1/rate_plan.rb', line 266

def to_s
    context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
    "#<Twilio.Wireless.V1.RatePlanContext #{context}>"
end

#update(unique_name: :unset, friendly_name: :unset) ⇒ RatePlanInstance

Update the RatePlanInstance

Parameters:

  • unique_name (String) (defaults to: :unset)

    An application-defined string that uniquely identifies the resource. It can be used in place of the resource’s ‘sid` in the URL to address the resource.

  • friendly_name (String) (defaults to: :unset)

    A descriptive string that you create to describe the resource. It does not have to be unique.

Returns:



239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
# File 'lib/twilio-ruby/rest/wireless/v1/rate_plan.rb', line 239

def update(
    unique_name: :unset, 
    friendly_name: :unset
)

    data = Twilio::Values.of({
        'UniqueName' => unique_name,
        'FriendlyName' => friendly_name,
    })

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.update('POST', @uri, data: data, headers: headers)
    RatePlanInstance.new(
        @version,
        payload,
        sid: @solution[:sid],
    )
end