Class: Twilio::REST::Voice::V1::SourceIpMappingInstance

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

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, sid: nil) ⇒ SourceIpMappingInstance

Initialize the SourceIpMappingInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • sid (String) (defaults to: nil)

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


224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
# File 'lib/twilio-ruby/rest/voice/v1/source_ip_mapping.rb', line 224

def initialize(version, payload, sid: nil)
  super(version)

  # Marshaled Properties
  @properties = {
      'sid' => payload['sid'],
      'ip_record_sid' => payload['ip_record_sid'],
      'sip_domain_sid' => payload['sip_domain_sid'],
      'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
      'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
      'url' => payload['url'],
  }

  # Context
  @instance_context = nil
  @params = {'sid' => sid || @properties['sid'], }
end

Instance Method Details

#contextSourceIpMappingContext

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context

Returns:


246
247
248
249
250
251
# File 'lib/twilio-ruby/rest/voice/v1/source_ip_mapping.rb', line 246

def context
  unless @instance_context
    @instance_context = SourceIpMappingContext.new(@version, @params['sid'], )
  end
  @instance_context
end

#date_createdTime

Returns The RFC 2822 date and time in GMT that the resource was created.

Returns:

  • (Time)

    The RFC 2822 date and time in GMT that the resource was created


273
274
275
# File 'lib/twilio-ruby/rest/voice/v1/source_ip_mapping.rb', line 273

def date_created
  @properties['date_created']
end

#date_updatedTime

Returns The RFC 2822 date and time in GMT that the resource was last updated.

Returns:

  • (Time)

    The RFC 2822 date and time in GMT that the resource was last updated


279
280
281
# File 'lib/twilio-ruby/rest/voice/v1/source_ip_mapping.rb', line 279

def date_updated
  @properties['date_updated']
end

#deleteBoolean

Delete the SourceIpMappingInstance

Returns:

  • (Boolean)

    true if delete succeeds, false otherwise


308
309
310
# File 'lib/twilio-ruby/rest/voice/v1/source_ip_mapping.rb', line 308

def delete
  context.delete
end

#fetchSourceIpMappingInstance

Fetch the SourceIpMappingInstance

Returns:


292
293
294
# File 'lib/twilio-ruby/rest/voice/v1/source_ip_mapping.rb', line 292

def fetch
  context.fetch
end

#inspectObject

Provide a detailed, user friendly representation


321
322
323
324
# File 'lib/twilio-ruby/rest/voice/v1/source_ip_mapping.rb', line 321

def inspect
  values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
  "<Twilio.Voice.V1.SourceIpMappingInstance #{values}>"
end

#ip_record_sidString

Returns The unique string that identifies an IP Record.

Returns:

  • (String)

    The unique string that identifies an IP Record


261
262
263
# File 'lib/twilio-ruby/rest/voice/v1/source_ip_mapping.rb', line 261

def ip_record_sid
  @properties['ip_record_sid']
end

#sidString

Returns The unique string that identifies the resource.

Returns:

  • (String)

    The unique string that identifies the resource


255
256
257
# File 'lib/twilio-ruby/rest/voice/v1/source_ip_mapping.rb', line 255

def sid
  @properties['sid']
end

#sip_domain_sidString

Returns The unique string that identifies a SIP Domain.

Returns:

  • (String)

    The unique string that identifies a SIP Domain


267
268
269
# File 'lib/twilio-ruby/rest/voice/v1/source_ip_mapping.rb', line 267

def sip_domain_sid
  @properties['sip_domain_sid']
end

#to_sObject

Provide a user friendly representation


314
315
316
317
# File 'lib/twilio-ruby/rest/voice/v1/source_ip_mapping.rb', line 314

def to_s
  values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
  "<Twilio.Voice.V1.SourceIpMappingInstance #{values}>"
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:


301
302
303
# File 'lib/twilio-ruby/rest/voice/v1/source_ip_mapping.rb', line 301

def update(sip_domain_sid: nil)
  context.update(sip_domain_sid: sip_domain_sid, )
end

#urlString

Returns The absolute URL of the resource.

Returns:

  • (String)

    The absolute URL of the resource


285
286
287
# File 'lib/twilio-ruby/rest/voice/v1/source_ip_mapping.rb', line 285

def url
  @properties['url']
end