Class: Twilio::REST::Supersim::V1::FleetContext

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

Instance Method Summary collapse

Constructor Details

#initialize(version, sid) ⇒ FleetContext

Initialize the FleetContext

Parameters:

  • version (Version)

    Version that contains the resource

  • sid (String)

    The SID of the Fleet resource to update.



279
280
281
282
283
284
285
286
287
288
# File 'lib/twilio-ruby/rest/supersim/v1/fleet.rb', line 279

def initialize(version, sid)
    super(version)
    

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

    
end

Instance Method Details

#fetchFleetInstance

Fetch the FleetInstance

Returns:



292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
# File 'lib/twilio-ruby/rest/supersim/v1/fleet.rb', line 292

def fetch

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

#fetch_with_metadataFleetInstance

Fetch the FleetInstanceMetadata

Returns:



311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
# File 'lib/twilio-ruby/rest/supersim/v1/fleet.rb', line 311

def 

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

#inspectObject

Provide a detailed, user friendly representation



437
438
439
440
# File 'lib/twilio-ruby/rest/supersim/v1/fleet.rb', line 437

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

#to_sObject

Provide a user friendly representation



430
431
432
433
# File 'lib/twilio-ruby/rest/supersim/v1/fleet.rb', line 430

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

#update(unique_name: :unset, network_access_profile: :unset, ip_commands_url: :unset, ip_commands_method: :unset, sms_commands_url: :unset, sms_commands_method: :unset, data_limit: :unset) ⇒ FleetInstance

Update the FleetInstance

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.

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

    The SID or unique name of the Network Access Profile that will control which cellular networks the Fleet’s SIMs can connect to.

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

    The URL that will receive a webhook when a Super SIM in the Fleet is used to send an IP Command from your device to a special IP address. Your server should respond with an HTTP status code in the 200 range; any response body will be ignored.

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

    A string representing the HTTP method to use when making a request to ‘ip_commands_url`. Can be one of `POST` or `GET`. Defaults to `POST`.

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

    The URL that will receive a webhook when a Super SIM in the Fleet is used to send an SMS from your device to the SMS Commands number. Your server should respond with an HTTP status code in the 200 range; any response body will be ignored.

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

    A string representing the HTTP method to use when making a request to ‘sms_commands_url`. Can be one of `POST` or `GET`. Defaults to `POST`.

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

    The total data usage (download and upload combined) in Megabytes that each Super SIM assigned to the Fleet can consume during a billing period (normally one month). Value must be between 1MB (1) and 2TB (2,000,000). Defaults to 1GB (1,000).

Returns:



343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
# File 'lib/twilio-ruby/rest/supersim/v1/fleet.rb', line 343

def update(
  unique_name: :unset, 
  network_access_profile: :unset, 
  ip_commands_url: :unset, 
  ip_commands_method: :unset, 
  sms_commands_url: :unset, 
  sms_commands_method: :unset, 
  data_limit: :unset
)

    data = Twilio::Values.of({
        'UniqueName' => unique_name,
        'NetworkAccessProfile' => network_access_profile,
        'IpCommandsUrl' => ip_commands_url,
        'IpCommandsMethod' => ip_commands_method,
        'SmsCommandsUrl' => sms_commands_url,
        'SmsCommandsMethod' => sms_commands_method,
        'DataLimit' => data_limit,
    })

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

#update_with_metadata(unique_name: :unset, network_access_profile: :unset, ip_commands_url: :unset, ip_commands_method: :unset, sms_commands_url: :unset, sms_commands_method: :unset, data_limit: :unset) ⇒ FleetInstance

Update the FleetInstanceMetadata

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.

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

    The SID or unique name of the Network Access Profile that will control which cellular networks the Fleet’s SIMs can connect to.

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

    The URL that will receive a webhook when a Super SIM in the Fleet is used to send an IP Command from your device to a special IP address. Your server should respond with an HTTP status code in the 200 range; any response body will be ignored.

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

    A string representing the HTTP method to use when making a request to ‘ip_commands_url`. Can be one of `POST` or `GET`. Defaults to `POST`.

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

    The URL that will receive a webhook when a Super SIM in the Fleet is used to send an SMS from your device to the SMS Commands number. Your server should respond with an HTTP status code in the 200 range; any response body will be ignored.

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

    A string representing the HTTP method to use when making a request to ‘sms_commands_url`. Can be one of `POST` or `GET`. Defaults to `POST`.

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

    The total data usage (download and upload combined) in Megabytes that each Super SIM assigned to the Fleet can consume during a billing period (normally one month). Value must be between 1MB (1) and 2TB (2,000,000). Defaults to 1GB (1,000).

Returns:



387
388
389
390
391
392
393
394
395
396
397
398
399
400
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
# File 'lib/twilio-ruby/rest/supersim/v1/fleet.rb', line 387

def (
  unique_name: :unset, 
  network_access_profile: :unset, 
  ip_commands_url: :unset, 
  ip_commands_method: :unset, 
  sms_commands_url: :unset, 
  sms_commands_method: :unset, 
  data_limit: :unset
)

    data = Twilio::Values.of({
        'UniqueName' => unique_name,
        'NetworkAccessProfile' => network_access_profile,
        'IpCommandsUrl' => ip_commands_url,
        'IpCommandsMethod' => ip_commands_method,
        'SmsCommandsUrl' => sms_commands_url,
        'SmsCommandsMethod' => sms_commands_method,
        'DataLimit' => data_limit,
    })

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