Class: Twilio::REST::Voice::V1::SourceIpMappingContext

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

Instance Method Summary collapse

Constructor Details

#initialize(version, sid) ⇒ SourceIpMappingContext

Initialize the SourceIpMappingContext

Parameters:

  • version (Version)

    Version that contains the resource

  • sid (String)

    The Twilio-provided string that uniquely identifies the IP Record resource to update.



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

def initialize(version, sid)
    super(version)
    

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

    
end

Instance Method Details

#deleteBoolean

Delete the SourceIpMappingInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



234
235
236
237
238
239
240
241
242
# File 'lib/twilio-ruby/rest/voice/v1/source_ip_mapping.rb', line 234

def delete

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    

    @version.delete('DELETE', @uri, headers: headers)
end

#delete_with_metadataBoolean

Delete the SourceIpMappingInstanceMetadata

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
# File 'lib/twilio-ruby/rest/voice/v1/source_ip_mapping.rb', line 247

def 

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

#fetchSourceIpMappingInstance

Fetch the SourceIpMappingInstance

Returns:



266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
# File 'lib/twilio-ruby/rest/voice/v1/source_ip_mapping.rb', line 266

def fetch

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

#fetch_with_metadataSourceIpMappingInstance

Fetch the SourceIpMappingInstanceMetadata

Returns:



285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
# File 'lib/twilio-ruby/rest/voice/v1/source_ip_mapping.rb', line 285

def 

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

#inspectObject

Provide a detailed, user friendly representation



375
376
377
378
# File 'lib/twilio-ruby/rest/voice/v1/source_ip_mapping.rb', line 375

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

#to_sObject

Provide a user friendly representation



368
369
370
371
# File 'lib/twilio-ruby/rest/voice/v1/source_ip_mapping.rb', line 368

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

#update(sip_domain_sid: nil) ⇒ SourceIpMappingInstance

Update the SourceIpMappingInstance

Parameters:

  • sip_domain_sid (String) (defaults to: nil)

    The SID of the SIP Domain that the IP Record should be mapped to.

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/voice/v1/source_ip_mapping.rb', line 311

def update(
    sip_domain_sid: nil
)

    data = Twilio::Values.of({
        'SipDomainSid' => sip_domain_sid,
    })

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

#update_with_metadata(sip_domain_sid: nil) ⇒ SourceIpMappingInstance

Update the SourceIpMappingInstanceMetadata

Parameters:

  • sip_domain_sid (String) (defaults to: nil)

    The SID of the SIP Domain that the IP Record should be mapped to.

Returns:



337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
# File 'lib/twilio-ruby/rest/voice/v1/source_ip_mapping.rb', line 337

def (
  sip_domain_sid: nil
)

    data = Twilio::Values.of({
        'SipDomainSid' => sip_domain_sid,
    })

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