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



281
282
283
284
285
286
287
288
289
290
# File 'lib/twilio-ruby/rest/wireless/v1/rate_plan.rb', line 281

def initialize(version, sid)
    super(version)
    

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

    
end

Instance Method Details

#deleteBoolean

Delete the RatePlanInstance



294
295
296
297
298
299
300
301
302
# File 'lib/twilio-ruby/rest/wireless/v1/rate_plan.rb', line 294

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 RatePlanInstanceMetadata



307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
# File 'lib/twilio-ruby/rest/wireless/v1/rate_plan.rb', line 307

def 

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
      response = @version.('DELETE', @uri, headers: headers)
      ratePlan_instance = RatePlanInstance.new(
          @version,
          response.body,
          account_sid: @solution[:account_sid],
          sid: @solution[:sid],
      )
      .new(@version, ratePlan_instance, response.headers, response.status_code)
end

#fetchRatePlanInstance

Fetch the RatePlanInstance



326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
# File 'lib/twilio-ruby/rest/wireless/v1/rate_plan.rb', line 326

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

#fetch_with_metadataRatePlanInstance

Fetch the RatePlanInstanceMetadata



345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
# File 'lib/twilio-ruby/rest/wireless/v1/rate_plan.rb', line 345

def 

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

#inspectObject

Provide a detailed, user friendly representation



441
442
443
444
# File 'lib/twilio-ruby/rest/wireless/v1/rate_plan.rb', line 441

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

#to_sObject

Provide a user friendly representation



434
435
436
437
# File 'lib/twilio-ruby/rest/wireless/v1/rate_plan.rb', line 434

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



372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
# File 'lib/twilio-ruby/rest/wireless/v1/rate_plan.rb', line 372

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

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

Update the RatePlanInstanceMetadata



401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
# File 'lib/twilio-ruby/rest/wireless/v1/rate_plan.rb', line 401

def (
  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', })
    
    
    
    
    
    response = @version.('POST', @uri, data: data, headers: headers)
    rate_plan_instance = RatePlanInstance.new(
        @version,
        response.body,
        sid: @solution[:sid],
    )
    .new(
        @version,
        rate_plan_instance,
        response.headers,
        response.status_code
    )
end