Class: Twilio::REST::Supersim::V1::NetworkAccessProfileContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/supersim/v1/network_access_profile.rb,
lib/twilio-ruby/rest/supersim/v1/network_access_profile/network_access_profile_network.rb

Defined Under Namespace

Classes: NetworkAccessProfileNetworkContext, NetworkAccessProfileNetworkInstance, NetworkAccessProfileNetworkInstanceMetadata, NetworkAccessProfileNetworkList, NetworkAccessProfileNetworkListResponse, NetworkAccessProfileNetworkPage, NetworkAccessProfileNetworkPageMetadata

Instance Method Summary collapse

Constructor Details

#initialize(version, sid) ⇒ NetworkAccessProfileContext

Initialize the NetworkAccessProfileContext

Parameters:

  • version (Version)

    Version that contains the resource

  • sid (String)

    The SID of the Network Access Profile to update.



229
230
231
232
233
234
235
236
237
238
239
# File 'lib/twilio-ruby/rest/supersim/v1/network_access_profile.rb', line 229

def initialize(version, sid)
    super(version)
    

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

    # Dependents
    @networks = nil
end

Instance Method Details

#fetchNetworkAccessProfileInstance

Fetch the NetworkAccessProfileInstance

Returns:



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

def fetch

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

#fetch_with_metadataNetworkAccessProfileInstance

Fetch the NetworkAccessProfileInstanceMetadata

Returns:



262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
# File 'lib/twilio-ruby/rest/supersim/v1/network_access_profile.rb', line 262

def 

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

#inspectObject

Provide a detailed, user friendly representation



371
372
373
374
# File 'lib/twilio-ruby/rest/supersim/v1/network_access_profile.rb', line 371

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

#networks(sid = :unset) ⇒ NetworkAccessProfileNetworkList, NetworkAccessProfileNetworkContext

Access the networks

Returns:

Raises:

  • (ArgumentError)


346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
# File 'lib/twilio-ruby/rest/supersim/v1/network_access_profile.rb', line 346

def networks(sid=:unset)

    raise ArgumentError, 'sid cannot be nil' if sid.nil?

    if sid != :unset
        return NetworkAccessProfileNetworkContext.new(@version, @solution[:sid],sid )
    end

    unless @networks
        @networks = NetworkAccessProfileNetworkList.new(
            @version, network_access_profile_sid: @solution[:sid], )
    end

 @networks
end

#to_sObject

Provide a user friendly representation



364
365
366
367
# File 'lib/twilio-ruby/rest/supersim/v1/network_access_profile.rb', line 364

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

#update(unique_name: :unset) ⇒ NetworkAccessProfileInstance

Update the NetworkAccessProfileInstance

Parameters:

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

    The new unique name of the Network Access Profile.

Returns:



288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
# File 'lib/twilio-ruby/rest/supersim/v1/network_access_profile.rb', line 288

def update(
  unique_name: :unset
)

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

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

#update_with_metadata(unique_name: :unset) ⇒ NetworkAccessProfileInstance

Update the NetworkAccessProfileInstanceMetadata

Parameters:

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

    The new unique name of the Network Access Profile.

Returns:



314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
# File 'lib/twilio-ruby/rest/supersim/v1/network_access_profile.rb', line 314

def (
  unique_name: :unset
)

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

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