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, NetworkAccessProfileNetworkList, NetworkAccessProfileNetworkPage

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.



164
165
166
167
168
169
170
171
172
173
# File 'lib/twilio-ruby/rest/supersim/v1/network_access_profile.rb', line 164

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:



177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
# File 'lib/twilio-ruby/rest/supersim/v1/network_access_profile.rb', line 177

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

#inspectObject

Provide a detailed, user friendly representation



248
249
250
251
# File 'lib/twilio-ruby/rest/supersim/v1/network_access_profile.rb', line 248

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)


223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
# File 'lib/twilio-ruby/rest/supersim/v1/network_access_profile.rb', line 223

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



241
242
243
244
# File 'lib/twilio-ruby/rest/supersim/v1/network_access_profile.rb', line 241

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:



197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
# File 'lib/twilio-ruby/rest/supersim/v1/network_access_profile.rb', line 197

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