Class: Twilio::REST::Wireless::V1::SimContext

Inherits:
InstanceContext show all
Defined in:
lib/twilio-ruby/rest/wireless/v1/sim.rb,
lib/twilio-ruby/rest/wireless/v1/sim/data_session.rb,
lib/twilio-ruby/rest/wireless/v1/sim/usage_record.rb

Defined Under Namespace

Classes: DataSessionInstance, DataSessionList, DataSessionPage, UsageRecordInstance, UsageRecordList, UsageRecordPage

Instance Method Summary collapse

Constructor Details

#initialize(version, sid) ⇒ SimContext

Initialize the SimContext



166
167
168
169
170
171
172
173
174
175
176
# File 'lib/twilio-ruby/rest/wireless/v1/sim.rb', line 166

def initialize(version, sid)
    super(version)

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

    # Dependents
    @data_sessions = nil
    @usage_records = nil
end

Instance Method Details

#data_sessionsDataSessionList, DataSessionContext

Access the data_sessions



289
290
291
292
293
294
295
# File 'lib/twilio-ruby/rest/wireless/v1/sim.rb', line 289

def data_sessions
  unless @data_sessions
    @data_sessions = DataSessionList.new(
            @version, sim_sid: @solution[:sid], )
  end
  @data_sessions
end

#deleteBoolean

Delete the SimInstance



180
181
182
183
184
185
186
187
# File 'lib/twilio-ruby/rest/wireless/v1/sim.rb', line 180

def delete

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

#fetchSimInstance

Fetch the SimInstance



192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
# File 'lib/twilio-ruby/rest/wireless/v1/sim.rb', line 192

def fetch

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

#inspectObject

Provide a detailed, user friendly representation



317
318
319
320
# File 'lib/twilio-ruby/rest/wireless/v1/sim.rb', line 317

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

#to_sObject

Provide a user friendly representation



310
311
312
313
# File 'lib/twilio-ruby/rest/wireless/v1/sim.rb', line 310

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

#update(unique_name: :unset, callback_method: :unset, callback_url: :unset, friendly_name: :unset, rate_plan: :unset, status: :unset, commands_callback_method: :unset, commands_callback_url: :unset, sms_fallback_method: :unset, sms_fallback_url: :unset, sms_method: :unset, sms_url: :unset, voice_fallback_method: :unset, voice_fallback_url: :unset, voice_method: :unset, voice_url: :unset, reset_status: :unset, account_sid: :unset) ⇒ SimInstance

Update the SimInstance



229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
# File 'lib/twilio-ruby/rest/wireless/v1/sim.rb', line 229

def update(
    unique_name: :unset, 
    callback_method: :unset, 
    callback_url: :unset, 
    friendly_name: :unset, 
    rate_plan: :unset, 
    status: :unset, 
    commands_callback_method: :unset, 
    commands_callback_url: :unset, 
    sms_fallback_method: :unset, 
    sms_fallback_url: :unset, 
    sms_method: :unset, 
    sms_url: :unset, 
    voice_fallback_method: :unset, 
    voice_fallback_url: :unset, 
    voice_method: :unset, 
    voice_url: :unset, 
    reset_status: :unset, 
    account_sid: :unset
)

    data = Twilio::Values.of({
        'UniqueName' => unique_name,
        'CallbackMethod' => callback_method,
        'CallbackUrl' => callback_url,
        'FriendlyName' => friendly_name,
        'RatePlan' => rate_plan,
        'Status' => status,
        'CommandsCallbackMethod' => commands_callback_method,
        'CommandsCallbackUrl' => commands_callback_url,
        'SmsFallbackMethod' => sms_fallback_method,
        'SmsFallbackUrl' => sms_fallback_url,
        'SmsMethod' => sms_method,
        'SmsUrl' => sms_url,
        'VoiceFallbackMethod' => voice_fallback_method,
        'VoiceFallbackUrl' => voice_fallback_url,
        'VoiceMethod' => voice_method,
        'VoiceUrl' => voice_url,
        'ResetStatus' => reset_status,
        'AccountSid' => ,
    })

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

#usage_recordsUsageRecordList, UsageRecordContext

Access the usage_records



300
301
302
303
304
305
306
# File 'lib/twilio-ruby/rest/wireless/v1/sim.rb', line 300

def usage_records
  unless @usage_records
    @usage_records = UsageRecordList.new(
            @version, sim_sid: @solution[:sid], )
  end
  @usage_records
end