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

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

Overview

PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.

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



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

def initialize(version, sid)
  super(version)

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

Instance Method Details

#deleteBoolean

Deletes the RatePlanInstance

Returns:

  • (Boolean)

    true if delete succeeds, true otherwise



263
264
265
# File 'lib/twilio-ruby/rest/wireless/v1/rate_plan.rb', line 263

def delete
  @version.delete('delete', @uri)
end

#fetchRatePlanInstance

Fetch a RatePlanInstance

Returns:



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

def fetch
  params = Twilio::Values.of({})

  payload = @version.fetch(
      'GET',
      @uri,
      params,
  )

  RatePlanInstance.new(
      @version,
      payload,
      sid: @solution[:sid],
  )
end

#to_sObject

Provide a user friendly representation



269
270
271
272
# File 'lib/twilio-ruby/rest/wireless/v1/rate_plan.rb', line 269

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)

    The unique_name

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

    The friendly_name

Returns:



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

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

  payload = @version.update(
      'POST',
      @uri,
      data: data,
  )

  RatePlanInstance.new(
      @version,
      payload,
      sid: @solution[:sid],
  )
end