twilio-ruby 5.34.0 → 5.34.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +32 -0
  3. data/README.md +2 -2
  4. data/lib/twilio-ruby/rest/api/v2010/account/sip/domain.rb +38 -3
  5. data/lib/twilio-ruby/rest/autopilot.rb +6 -0
  6. data/lib/twilio-ruby/rest/autopilot/v1.rb +7 -0
  7. data/lib/twilio-ruby/rest/autopilot/v1/restore_assistant.rb +198 -0
  8. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle.rb +26 -0
  9. data/lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/bundle/evaluation.rb +324 -0
  10. data/lib/twilio-ruby/rest/supersim.rb +8 -0
  11. data/lib/twilio-ruby/rest/supersim/v1.rb +15 -0
  12. data/lib/twilio-ruby/rest/supersim/v1/fleet.rb +44 -10
  13. data/lib/twilio-ruby/rest/supersim/v1/network_access_profile.rb +337 -0
  14. data/lib/twilio-ruby/rest/verify/v2/service.rb +22 -3
  15. data/lib/twilio-ruby/rest/verify/v2/service/verification.rb +3 -3
  16. data/lib/twilio-ruby/rest/voice.rb +36 -0
  17. data/lib/twilio-ruby/rest/voice/v1.rb +64 -0
  18. data/lib/twilio-ruby/rest/voice/v1/byoc_trunk.rb +513 -0
  19. data/lib/twilio-ruby/rest/voice/v1/connection_policy.rb +379 -0
  20. data/lib/twilio-ruby/rest/voice/v1/connection_policy/connection_policy_target.rb +458 -0
  21. data/lib/twilio-ruby/rest/voice/v1/ip_record.rb +366 -0
  22. data/lib/twilio-ruby/rest/voice/v1/source_ip_mapping.rb +346 -0
  23. data/lib/twilio-ruby/version.rb +1 -1
  24. data/spec/integration/api/v2010/account/sip/domain_spec.rb +12 -4
  25. data/spec/integration/api/v2010/account/token_spec.rb +23 -11
  26. data/spec/integration/autopilot/v1/restore_assistant_spec.rb +53 -0
  27. data/spec/integration/numbers/v2/regulatory_compliance/bundle/evaluation_spec.rb +623 -0
  28. data/spec/integration/numbers/v2/regulatory_compliance/bundle_spec.rb +4 -0
  29. data/spec/integration/supersim/v1/fleet_spec.rb +8 -4
  30. data/spec/integration/supersim/v1/network_access_profile_spec.rb +208 -0
  31. data/spec/integration/verify/v2/service_spec.rb +4 -0
  32. data/spec/integration/voice/v1/byoc_trunk_spec.rb +250 -0
  33. data/spec/integration/voice/v1/connection_policy/connection_policy_target_spec.rb +246 -0
  34. data/spec/integration/voice/v1/connection_policy_spec.rb +226 -0
  35. data/spec/integration/voice/v1/ip_record_spec.rb +223 -0
  36. data/spec/integration/voice/v1/source_ip_mapping_spec.rb +219 -0
  37. data/twilio-ruby.gemspec +1 -1
  38. metadata +28 -3
@@ -0,0 +1,366 @@
1
+ ##
2
+ # This code was generated by
3
+ # \ / _ _ _| _ _
4
+ # | (_)\/(_)(_|\/| |(/_ v1.0.0
5
+ # / /
6
+ #
7
+ # frozen_string_literal: true
8
+
9
+ module Twilio
10
+ module REST
11
+ class Voice < Domain
12
+ class V1 < Version
13
+ class IpRecordList < ListResource
14
+ ##
15
+ # Initialize the IpRecordList
16
+ # @param [Version] version Version that contains the resource
17
+ # @return [IpRecordList] IpRecordList
18
+ def initialize(version)
19
+ super(version)
20
+
21
+ # Path Solution
22
+ @solution = {}
23
+ @uri = "/IpRecords"
24
+ end
25
+
26
+ ##
27
+ # Retrieve a single page of IpRecordInstance records from the API.
28
+ # Request is executed immediately.
29
+ # @param [String] ip_address An IP address in dotted decimal notation, IPv4 only.
30
+ # @param [String] friendly_name A descriptive string that you create to describe
31
+ # the resource. It is not unique and can be up to 255 characters long.
32
+ # @param [String] cidr_prefix_length An integer representing the length of the
33
+ # [CIDR](https://tools.ietf.org/html/rfc4632) prefix to use with this IP address.
34
+ # By default the entire IP address is used, which for IPv4 is value 32.
35
+ # @return [IpRecordInstance] Newly created IpRecordInstance
36
+ def create(ip_address: nil, friendly_name: :unset, cidr_prefix_length: :unset)
37
+ data = Twilio::Values.of({
38
+ 'IpAddress' => ip_address,
39
+ 'FriendlyName' => friendly_name,
40
+ 'CidrPrefixLength' => cidr_prefix_length,
41
+ })
42
+
43
+ payload = @version.create(
44
+ 'POST',
45
+ @uri,
46
+ data: data
47
+ )
48
+
49
+ IpRecordInstance.new(@version, payload, )
50
+ end
51
+
52
+ ##
53
+ # Lists IpRecordInstance records from the API as a list.
54
+ # Unlike stream(), this operation is eager and will load `limit` records into
55
+ # memory before returning.
56
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
57
+ # guarantees to never return more than limit. Default is no limit
58
+ # @param [Integer] page_size Number of records to fetch per request, when
59
+ # not set will use the default value of 50 records. If no page_size is defined
60
+ # but a limit is defined, stream() will attempt to read the limit with the most
61
+ # efficient page size, i.e. min(limit, 1000)
62
+ # @return [Array] Array of up to limit results
63
+ def list(limit: nil, page_size: nil)
64
+ self.stream(limit: limit, page_size: page_size).entries
65
+ end
66
+
67
+ ##
68
+ # Streams IpRecordInstance records from the API as an Enumerable.
69
+ # This operation lazily loads records as efficiently as possible until the limit
70
+ # is reached.
71
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
72
+ # guarantees to never return more than limit. Default is no limit.
73
+ # @param [Integer] page_size Number of records to fetch per request, when
74
+ # not set will use the default value of 50 records. If no page_size is defined
75
+ # but a limit is defined, stream() will attempt to read the limit with the most
76
+ # efficient page size, i.e. min(limit, 1000)
77
+ # @return [Enumerable] Enumerable that will yield up to limit results
78
+ def stream(limit: nil, page_size: nil)
79
+ limits = @version.read_limits(limit, page_size)
80
+
81
+ page = self.page(page_size: limits[:page_size], )
82
+
83
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
84
+ end
85
+
86
+ ##
87
+ # When passed a block, yields IpRecordInstance records from the API.
88
+ # This operation lazily loads records as efficiently as possible until the limit
89
+ # is reached.
90
+ def each
91
+ limits = @version.read_limits
92
+
93
+ page = self.page(page_size: limits[:page_size], )
94
+
95
+ @version.stream(page,
96
+ limit: limits[:limit],
97
+ page_limit: limits[:page_limit]).each {|x| yield x}
98
+ end
99
+
100
+ ##
101
+ # Retrieve a single page of IpRecordInstance records from the API.
102
+ # Request is executed immediately.
103
+ # @param [String] page_token PageToken provided by the API
104
+ # @param [Integer] page_number Page Number, this value is simply for client state
105
+ # @param [Integer] page_size Number of records to return, defaults to 50
106
+ # @return [Page] Page of IpRecordInstance
107
+ def page(page_token: :unset, page_number: :unset, page_size: :unset)
108
+ params = Twilio::Values.of({
109
+ 'PageToken' => page_token,
110
+ 'Page' => page_number,
111
+ 'PageSize' => page_size,
112
+ })
113
+ response = @version.page(
114
+ 'GET',
115
+ @uri,
116
+ params
117
+ )
118
+ IpRecordPage.new(@version, response, @solution)
119
+ end
120
+
121
+ ##
122
+ # Retrieve a single page of IpRecordInstance records from the API.
123
+ # Request is executed immediately.
124
+ # @param [String] target_url API-generated URL for the requested results page
125
+ # @return [Page] Page of IpRecordInstance
126
+ def get_page(target_url)
127
+ response = @version.domain.request(
128
+ 'GET',
129
+ target_url
130
+ )
131
+ IpRecordPage.new(@version, response, @solution)
132
+ end
133
+
134
+ ##
135
+ # Provide a user friendly representation
136
+ def to_s
137
+ '#<Twilio.Voice.V1.IpRecordList>'
138
+ end
139
+ end
140
+
141
+ class IpRecordPage < Page
142
+ ##
143
+ # Initialize the IpRecordPage
144
+ # @param [Version] version Version that contains the resource
145
+ # @param [Response] response Response from the API
146
+ # @param [Hash] solution Path solution for the resource
147
+ # @return [IpRecordPage] IpRecordPage
148
+ def initialize(version, response, solution)
149
+ super(version, response)
150
+
151
+ # Path Solution
152
+ @solution = solution
153
+ end
154
+
155
+ ##
156
+ # Build an instance of IpRecordInstance
157
+ # @param [Hash] payload Payload response from the API
158
+ # @return [IpRecordInstance] IpRecordInstance
159
+ def get_instance(payload)
160
+ IpRecordInstance.new(@version, payload, )
161
+ end
162
+
163
+ ##
164
+ # Provide a user friendly representation
165
+ def to_s
166
+ '<Twilio.Voice.V1.IpRecordPage>'
167
+ end
168
+ end
169
+
170
+ class IpRecordContext < InstanceContext
171
+ ##
172
+ # Initialize the IpRecordContext
173
+ # @param [Version] version Version that contains the resource
174
+ # @param [String] sid The Twilio-provided string that uniquely identifies the IP
175
+ # Record resource to fetch.
176
+ # @return [IpRecordContext] IpRecordContext
177
+ def initialize(version, sid)
178
+ super(version)
179
+
180
+ # Path Solution
181
+ @solution = {sid: sid, }
182
+ @uri = "/IpRecords/#{@solution[:sid]}"
183
+ end
184
+
185
+ ##
186
+ # Fetch a IpRecordInstance
187
+ # @return [IpRecordInstance] Fetched IpRecordInstance
188
+ def fetch
189
+ params = Twilio::Values.of({})
190
+
191
+ payload = @version.fetch(
192
+ 'GET',
193
+ @uri,
194
+ params,
195
+ )
196
+
197
+ IpRecordInstance.new(@version, payload, sid: @solution[:sid], )
198
+ end
199
+
200
+ ##
201
+ # Update the IpRecordInstance
202
+ # @param [String] friendly_name A descriptive string that you create to describe
203
+ # the resource. It is not unique and can be up to 255 characters long.
204
+ # @return [IpRecordInstance] Updated IpRecordInstance
205
+ def update(friendly_name: :unset)
206
+ data = Twilio::Values.of({'FriendlyName' => friendly_name, })
207
+
208
+ payload = @version.update(
209
+ 'POST',
210
+ @uri,
211
+ data: data,
212
+ )
213
+
214
+ IpRecordInstance.new(@version, payload, sid: @solution[:sid], )
215
+ end
216
+
217
+ ##
218
+ # Deletes the IpRecordInstance
219
+ # @return [Boolean] true if delete succeeds, false otherwise
220
+ def delete
221
+ @version.delete('delete', @uri)
222
+ end
223
+
224
+ ##
225
+ # Provide a user friendly representation
226
+ def to_s
227
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
228
+ "#<Twilio.Voice.V1.IpRecordContext #{context}>"
229
+ end
230
+
231
+ ##
232
+ # Provide a detailed, user friendly representation
233
+ def inspect
234
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
235
+ "#<Twilio.Voice.V1.IpRecordContext #{context}>"
236
+ end
237
+ end
238
+
239
+ class IpRecordInstance < InstanceResource
240
+ ##
241
+ # Initialize the IpRecordInstance
242
+ # @param [Version] version Version that contains the resource
243
+ # @param [Hash] payload payload that contains response from Twilio
244
+ # @param [String] sid The Twilio-provided string that uniquely identifies the IP
245
+ # Record resource to fetch.
246
+ # @return [IpRecordInstance] IpRecordInstance
247
+ def initialize(version, payload, sid: nil)
248
+ super(version)
249
+
250
+ # Marshaled Properties
251
+ @properties = {
252
+ 'account_sid' => payload['account_sid'],
253
+ 'sid' => payload['sid'],
254
+ 'friendly_name' => payload['friendly_name'],
255
+ 'ip_address' => payload['ip_address'],
256
+ 'cidr_prefix_length' => payload['cidr_prefix_length'].to_i,
257
+ 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
258
+ 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
259
+ 'url' => payload['url'],
260
+ }
261
+
262
+ # Context
263
+ @instance_context = nil
264
+ @params = {'sid' => sid || @properties['sid'], }
265
+ end
266
+
267
+ ##
268
+ # Generate an instance context for the instance, the context is capable of
269
+ # performing various actions. All instance actions are proxied to the context
270
+ # @return [IpRecordContext] IpRecordContext for this IpRecordInstance
271
+ def context
272
+ unless @instance_context
273
+ @instance_context = IpRecordContext.new(@version, @params['sid'], )
274
+ end
275
+ @instance_context
276
+ end
277
+
278
+ ##
279
+ # @return [String] The SID of the Account that created the resource
280
+ def account_sid
281
+ @properties['account_sid']
282
+ end
283
+
284
+ ##
285
+ # @return [String] The unique string that identifies the resource
286
+ def sid
287
+ @properties['sid']
288
+ end
289
+
290
+ ##
291
+ # @return [String] The string that you assigned to describe the resource
292
+ def friendly_name
293
+ @properties['friendly_name']
294
+ end
295
+
296
+ ##
297
+ # @return [String] An IP address in dotted decimal notation, IPv4 only.
298
+ def ip_address
299
+ @properties['ip_address']
300
+ end
301
+
302
+ ##
303
+ # @return [String] An integer representing the length of the [CIDR](https://tools.ietf.org/html/rfc4632) prefix to use with this IP address. By default the entire IP address is used, which for IPv4 is value 32.
304
+ def cidr_prefix_length
305
+ @properties['cidr_prefix_length']
306
+ end
307
+
308
+ ##
309
+ # @return [Time] The RFC 2822 date and time in GMT that the resource was created
310
+ def date_created
311
+ @properties['date_created']
312
+ end
313
+
314
+ ##
315
+ # @return [Time] The RFC 2822 date and time in GMT that the resource was last updated
316
+ def date_updated
317
+ @properties['date_updated']
318
+ end
319
+
320
+ ##
321
+ # @return [String] The absolute URL of the resource
322
+ def url
323
+ @properties['url']
324
+ end
325
+
326
+ ##
327
+ # Fetch a IpRecordInstance
328
+ # @return [IpRecordInstance] Fetched IpRecordInstance
329
+ def fetch
330
+ context.fetch
331
+ end
332
+
333
+ ##
334
+ # Update the IpRecordInstance
335
+ # @param [String] friendly_name A descriptive string that you create to describe
336
+ # the resource. It is not unique and can be up to 255 characters long.
337
+ # @return [IpRecordInstance] Updated IpRecordInstance
338
+ def update(friendly_name: :unset)
339
+ context.update(friendly_name: friendly_name, )
340
+ end
341
+
342
+ ##
343
+ # Deletes the IpRecordInstance
344
+ # @return [Boolean] true if delete succeeds, false otherwise
345
+ def delete
346
+ context.delete
347
+ end
348
+
349
+ ##
350
+ # Provide a user friendly representation
351
+ def to_s
352
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
353
+ "<Twilio.Voice.V1.IpRecordInstance #{values}>"
354
+ end
355
+
356
+ ##
357
+ # Provide a detailed, user friendly representation
358
+ def inspect
359
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
360
+ "<Twilio.Voice.V1.IpRecordInstance #{values}>"
361
+ end
362
+ end
363
+ end
364
+ end
365
+ end
366
+ end
@@ -0,0 +1,346 @@
1
+ ##
2
+ # This code was generated by
3
+ # \ / _ _ _| _ _
4
+ # | (_)\/(_)(_|\/| |(/_ v1.0.0
5
+ # / /
6
+ #
7
+ # frozen_string_literal: true
8
+
9
+ module Twilio
10
+ module REST
11
+ class Voice < Domain
12
+ class V1 < Version
13
+ class SourceIpMappingList < ListResource
14
+ ##
15
+ # Initialize the SourceIpMappingList
16
+ # @param [Version] version Version that contains the resource
17
+ # @return [SourceIpMappingList] SourceIpMappingList
18
+ def initialize(version)
19
+ super(version)
20
+
21
+ # Path Solution
22
+ @solution = {}
23
+ @uri = "/SourceIpMappings"
24
+ end
25
+
26
+ ##
27
+ # Retrieve a single page of SourceIpMappingInstance records from the API.
28
+ # Request is executed immediately.
29
+ # @param [String] ip_record_sid The Twilio-provided string that uniquely
30
+ # identifies the IP Record resource to map from.
31
+ # @param [String] sip_domain_sid The SID of the SIP Domain that the IP Record
32
+ # should be mapped to.
33
+ # @return [SourceIpMappingInstance] Newly created SourceIpMappingInstance
34
+ def create(ip_record_sid: nil, sip_domain_sid: nil)
35
+ data = Twilio::Values.of({'IpRecordSid' => ip_record_sid, 'SipDomainSid' => sip_domain_sid, })
36
+
37
+ payload = @version.create(
38
+ 'POST',
39
+ @uri,
40
+ data: data
41
+ )
42
+
43
+ SourceIpMappingInstance.new(@version, payload, )
44
+ end
45
+
46
+ ##
47
+ # Lists SourceIpMappingInstance records from the API as a list.
48
+ # Unlike stream(), this operation is eager and will load `limit` records into
49
+ # memory before returning.
50
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
51
+ # guarantees to never return more than limit. Default is no limit
52
+ # @param [Integer] page_size Number of records to fetch per request, when
53
+ # not set will use the default value of 50 records. If no page_size is defined
54
+ # but a limit is defined, stream() will attempt to read the limit with the most
55
+ # efficient page size, i.e. min(limit, 1000)
56
+ # @return [Array] Array of up to limit results
57
+ def list(limit: nil, page_size: nil)
58
+ self.stream(limit: limit, page_size: page_size).entries
59
+ end
60
+
61
+ ##
62
+ # Streams SourceIpMappingInstance records from the API as an Enumerable.
63
+ # This operation lazily loads records as efficiently as possible until the limit
64
+ # is reached.
65
+ # @param [Integer] limit Upper limit for the number of records to return. stream()
66
+ # guarantees to never return more than limit. Default is no limit.
67
+ # @param [Integer] page_size Number of records to fetch per request, when
68
+ # not set will use the default value of 50 records. If no page_size is defined
69
+ # but a limit is defined, stream() will attempt to read the limit with the most
70
+ # efficient page size, i.e. min(limit, 1000)
71
+ # @return [Enumerable] Enumerable that will yield up to limit results
72
+ def stream(limit: nil, page_size: nil)
73
+ limits = @version.read_limits(limit, page_size)
74
+
75
+ page = self.page(page_size: limits[:page_size], )
76
+
77
+ @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
78
+ end
79
+
80
+ ##
81
+ # When passed a block, yields SourceIpMappingInstance records from the API.
82
+ # This operation lazily loads records as efficiently as possible until the limit
83
+ # is reached.
84
+ def each
85
+ limits = @version.read_limits
86
+
87
+ page = self.page(page_size: limits[:page_size], )
88
+
89
+ @version.stream(page,
90
+ limit: limits[:limit],
91
+ page_limit: limits[:page_limit]).each {|x| yield x}
92
+ end
93
+
94
+ ##
95
+ # Retrieve a single page of SourceIpMappingInstance records from the API.
96
+ # Request is executed immediately.
97
+ # @param [String] page_token PageToken provided by the API
98
+ # @param [Integer] page_number Page Number, this value is simply for client state
99
+ # @param [Integer] page_size Number of records to return, defaults to 50
100
+ # @return [Page] Page of SourceIpMappingInstance
101
+ def page(page_token: :unset, page_number: :unset, page_size: :unset)
102
+ params = Twilio::Values.of({
103
+ 'PageToken' => page_token,
104
+ 'Page' => page_number,
105
+ 'PageSize' => page_size,
106
+ })
107
+ response = @version.page(
108
+ 'GET',
109
+ @uri,
110
+ params
111
+ )
112
+ SourceIpMappingPage.new(@version, response, @solution)
113
+ end
114
+
115
+ ##
116
+ # Retrieve a single page of SourceIpMappingInstance records from the API.
117
+ # Request is executed immediately.
118
+ # @param [String] target_url API-generated URL for the requested results page
119
+ # @return [Page] Page of SourceIpMappingInstance
120
+ def get_page(target_url)
121
+ response = @version.domain.request(
122
+ 'GET',
123
+ target_url
124
+ )
125
+ SourceIpMappingPage.new(@version, response, @solution)
126
+ end
127
+
128
+ ##
129
+ # Provide a user friendly representation
130
+ def to_s
131
+ '#<Twilio.Voice.V1.SourceIpMappingList>'
132
+ end
133
+ end
134
+
135
+ class SourceIpMappingPage < Page
136
+ ##
137
+ # Initialize the SourceIpMappingPage
138
+ # @param [Version] version Version that contains the resource
139
+ # @param [Response] response Response from the API
140
+ # @param [Hash] solution Path solution for the resource
141
+ # @return [SourceIpMappingPage] SourceIpMappingPage
142
+ def initialize(version, response, solution)
143
+ super(version, response)
144
+
145
+ # Path Solution
146
+ @solution = solution
147
+ end
148
+
149
+ ##
150
+ # Build an instance of SourceIpMappingInstance
151
+ # @param [Hash] payload Payload response from the API
152
+ # @return [SourceIpMappingInstance] SourceIpMappingInstance
153
+ def get_instance(payload)
154
+ SourceIpMappingInstance.new(@version, payload, )
155
+ end
156
+
157
+ ##
158
+ # Provide a user friendly representation
159
+ def to_s
160
+ '<Twilio.Voice.V1.SourceIpMappingPage>'
161
+ end
162
+ end
163
+
164
+ class SourceIpMappingContext < InstanceContext
165
+ ##
166
+ # Initialize the SourceIpMappingContext
167
+ # @param [Version] version Version that contains the resource
168
+ # @param [String] sid The Twilio-provided string that uniquely identifies the IP
169
+ # Record resource to fetch.
170
+ # @return [SourceIpMappingContext] SourceIpMappingContext
171
+ def initialize(version, sid)
172
+ super(version)
173
+
174
+ # Path Solution
175
+ @solution = {sid: sid, }
176
+ @uri = "/SourceIpMappings/#{@solution[:sid]}"
177
+ end
178
+
179
+ ##
180
+ # Fetch a SourceIpMappingInstance
181
+ # @return [SourceIpMappingInstance] Fetched SourceIpMappingInstance
182
+ def fetch
183
+ params = Twilio::Values.of({})
184
+
185
+ payload = @version.fetch(
186
+ 'GET',
187
+ @uri,
188
+ params,
189
+ )
190
+
191
+ SourceIpMappingInstance.new(@version, payload, sid: @solution[:sid], )
192
+ end
193
+
194
+ ##
195
+ # Update the SourceIpMappingInstance
196
+ # @param [String] sip_domain_sid The SID of the SIP Domain that the IP Record
197
+ # should be mapped to.
198
+ # @return [SourceIpMappingInstance] Updated SourceIpMappingInstance
199
+ def update(sip_domain_sid: nil)
200
+ data = Twilio::Values.of({'SipDomainSid' => sip_domain_sid, })
201
+
202
+ payload = @version.update(
203
+ 'POST',
204
+ @uri,
205
+ data: data,
206
+ )
207
+
208
+ SourceIpMappingInstance.new(@version, payload, sid: @solution[:sid], )
209
+ end
210
+
211
+ ##
212
+ # Deletes the SourceIpMappingInstance
213
+ # @return [Boolean] true if delete succeeds, false otherwise
214
+ def delete
215
+ @version.delete('delete', @uri)
216
+ end
217
+
218
+ ##
219
+ # Provide a user friendly representation
220
+ def to_s
221
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
222
+ "#<Twilio.Voice.V1.SourceIpMappingContext #{context}>"
223
+ end
224
+
225
+ ##
226
+ # Provide a detailed, user friendly representation
227
+ def inspect
228
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
229
+ "#<Twilio.Voice.V1.SourceIpMappingContext #{context}>"
230
+ end
231
+ end
232
+
233
+ class SourceIpMappingInstance < InstanceResource
234
+ ##
235
+ # Initialize the SourceIpMappingInstance
236
+ # @param [Version] version Version that contains the resource
237
+ # @param [Hash] payload payload that contains response from Twilio
238
+ # @param [String] sid The Twilio-provided string that uniquely identifies the IP
239
+ # Record resource to fetch.
240
+ # @return [SourceIpMappingInstance] SourceIpMappingInstance
241
+ def initialize(version, payload, sid: nil)
242
+ super(version)
243
+
244
+ # Marshaled Properties
245
+ @properties = {
246
+ 'sid' => payload['sid'],
247
+ 'ip_record_sid' => payload['ip_record_sid'],
248
+ 'sip_domain_sid' => payload['sip_domain_sid'],
249
+ 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
250
+ 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
251
+ 'url' => payload['url'],
252
+ }
253
+
254
+ # Context
255
+ @instance_context = nil
256
+ @params = {'sid' => sid || @properties['sid'], }
257
+ end
258
+
259
+ ##
260
+ # Generate an instance context for the instance, the context is capable of
261
+ # performing various actions. All instance actions are proxied to the context
262
+ # @return [SourceIpMappingContext] SourceIpMappingContext for this SourceIpMappingInstance
263
+ def context
264
+ unless @instance_context
265
+ @instance_context = SourceIpMappingContext.new(@version, @params['sid'], )
266
+ end
267
+ @instance_context
268
+ end
269
+
270
+ ##
271
+ # @return [String] The unique string that identifies the resource
272
+ def sid
273
+ @properties['sid']
274
+ end
275
+
276
+ ##
277
+ # @return [String] The unique string that identifies an IP Record
278
+ def ip_record_sid
279
+ @properties['ip_record_sid']
280
+ end
281
+
282
+ ##
283
+ # @return [String] The unique string that identifies a SIP Domain
284
+ def sip_domain_sid
285
+ @properties['sip_domain_sid']
286
+ end
287
+
288
+ ##
289
+ # @return [Time] The RFC 2822 date and time in GMT that the resource was created
290
+ def date_created
291
+ @properties['date_created']
292
+ end
293
+
294
+ ##
295
+ # @return [Time] The RFC 2822 date and time in GMT that the resource was last updated
296
+ def date_updated
297
+ @properties['date_updated']
298
+ end
299
+
300
+ ##
301
+ # @return [String] The absolute URL of the resource
302
+ def url
303
+ @properties['url']
304
+ end
305
+
306
+ ##
307
+ # Fetch a SourceIpMappingInstance
308
+ # @return [SourceIpMappingInstance] Fetched SourceIpMappingInstance
309
+ def fetch
310
+ context.fetch
311
+ end
312
+
313
+ ##
314
+ # Update the SourceIpMappingInstance
315
+ # @param [String] sip_domain_sid The SID of the SIP Domain that the IP Record
316
+ # should be mapped to.
317
+ # @return [SourceIpMappingInstance] Updated SourceIpMappingInstance
318
+ def update(sip_domain_sid: nil)
319
+ context.update(sip_domain_sid: sip_domain_sid, )
320
+ end
321
+
322
+ ##
323
+ # Deletes the SourceIpMappingInstance
324
+ # @return [Boolean] true if delete succeeds, false otherwise
325
+ def delete
326
+ context.delete
327
+ end
328
+
329
+ ##
330
+ # Provide a user friendly representation
331
+ def to_s
332
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
333
+ "<Twilio.Voice.V1.SourceIpMappingInstance #{values}>"
334
+ end
335
+
336
+ ##
337
+ # Provide a detailed, user friendly representation
338
+ def inspect
339
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
340
+ "<Twilio.Voice.V1.SourceIpMappingInstance #{values}>"
341
+ end
342
+ end
343
+ end
344
+ end
345
+ end
346
+ end