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.



221
222
223
224
225
226
227
228
229
230
231
# File 'lib/twilio-ruby/rest/supersim/v1/network_access_profile.rb', line 221

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:



235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
# File 'lib/twilio-ruby/rest/supersim/v1/network_access_profile.rb', line 235

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:



254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
# File 'lib/twilio-ruby/rest/supersim/v1/network_access_profile.rb', line 254

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



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

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)


338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
# File 'lib/twilio-ruby/rest/supersim/v1/network_access_profile.rb', line 338

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



356
357
358
359
# File 'lib/twilio-ruby/rest/supersim/v1/network_access_profile.rb', line 356

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:



280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
# File 'lib/twilio-ruby/rest/supersim/v1/network_access_profile.rb', line 280

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:



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

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