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.



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

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



176
177
178
179
180
181
182
183
# File 'lib/twilio-ruby/rest/voice/v1/source_ip_mapping.rb', line 176

def delete

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    @version.delete('DELETE', @uri, headers: headers)
end

#fetchSourceIpMappingInstance

Fetch the SourceIpMappingInstance

Returns:



188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
# File 'lib/twilio-ruby/rest/voice/v1/source_ip_mapping.rb', line 188

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

#inspectObject

Provide a detailed, user friendly representation



240
241
242
243
# File 'lib/twilio-ruby/rest/voice/v1/source_ip_mapping.rb', line 240

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

#to_sObject

Provide a user friendly representation



233
234
235
236
# File 'lib/twilio-ruby/rest/voice/v1/source_ip_mapping.rb', line 233

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:



208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
# File 'lib/twilio-ruby/rest/voice/v1/source_ip_mapping.rb', line 208

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