twilio-ruby 5.66.2 → 5.67.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,459 +0,0 @@
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 Fax < Domain
12
- class V1 < Version
13
- ##
14
- # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
15
- class FaxList < ListResource
16
- ##
17
- # Initialize the FaxList
18
- # @param [Version] version Version that contains the resource
19
- # @return [FaxList] FaxList
20
- def initialize(version)
21
- super(version)
22
-
23
- # Path Solution
24
- @solution = {}
25
- @uri = "/Faxes"
26
- end
27
-
28
- ##
29
- # Lists FaxInstance records from the API as a list.
30
- # Unlike stream(), this operation is eager and will load `limit` records into
31
- # memory before returning.
32
- # @param [String] from Retrieve only those faxes sent from this phone number,
33
- # specified in {E.164}[https://www.twilio.com/docs/glossary/what-e164] format.
34
- # @param [String] to Retrieve only those faxes sent to this phone number,
35
- # specified in {E.164}[https://www.twilio.com/docs/glossary/what-e164] format.
36
- # @param [Time] date_created_on_or_before Retrieve only those faxes with a
37
- # `date_created` that is before or equal to this value, specified in {ISO
38
- # 8601}[https://en.wikipedia.org/wiki/ISO_8601] format.
39
- # @param [Time] date_created_after Retrieve only those faxes with a `date_created`
40
- # that is later than this value, specified in {ISO
41
- # 8601}[https://en.wikipedia.org/wiki/ISO_8601] format.
42
- # @param [Integer] limit Upper limit for the number of records to return. stream()
43
- # guarantees to never return more than limit. Default is no limit
44
- # @param [Integer] page_size Number of records to fetch per request, when
45
- # not set will use the default value of 50 records. If no page_size is defined
46
- # but a limit is defined, stream() will attempt to read the limit with the most
47
- # efficient page size, i.e. min(limit, 1000)
48
- # @return [Array] Array of up to limit results
49
- def list(from: :unset, to: :unset, date_created_on_or_before: :unset, date_created_after: :unset, limit: nil, page_size: nil)
50
- self.stream(
51
- from: from,
52
- to: to,
53
- date_created_on_or_before: date_created_on_or_before,
54
- date_created_after: date_created_after,
55
- limit: limit,
56
- page_size: page_size
57
- ).entries
58
- end
59
-
60
- ##
61
- # Streams FaxInstance records from the API as an Enumerable.
62
- # This operation lazily loads records as efficiently as possible until the limit
63
- # is reached.
64
- # @param [String] from Retrieve only those faxes sent from this phone number,
65
- # specified in {E.164}[https://www.twilio.com/docs/glossary/what-e164] format.
66
- # @param [String] to Retrieve only those faxes sent to this phone number,
67
- # specified in {E.164}[https://www.twilio.com/docs/glossary/what-e164] format.
68
- # @param [Time] date_created_on_or_before Retrieve only those faxes with a
69
- # `date_created` that is before or equal to this value, specified in {ISO
70
- # 8601}[https://en.wikipedia.org/wiki/ISO_8601] format.
71
- # @param [Time] date_created_after Retrieve only those faxes with a `date_created`
72
- # that is later than this value, specified in {ISO
73
- # 8601}[https://en.wikipedia.org/wiki/ISO_8601] format.
74
- # @param [Integer] limit Upper limit for the number of records to return. stream()
75
- # guarantees to never return more than limit. Default is no limit.
76
- # @param [Integer] page_size Number of records to fetch per request, when
77
- # not set will use the default value of 50 records. If no page_size is defined
78
- # but a limit is defined, stream() will attempt to read the limit with the most
79
- # efficient page size, i.e. min(limit, 1000)
80
- # @return [Enumerable] Enumerable that will yield up to limit results
81
- def stream(from: :unset, to: :unset, date_created_on_or_before: :unset, date_created_after: :unset, limit: nil, page_size: nil)
82
- limits = @version.read_limits(limit, page_size)
83
-
84
- page = self.page(
85
- from: from,
86
- to: to,
87
- date_created_on_or_before: date_created_on_or_before,
88
- date_created_after: date_created_after,
89
- page_size: limits[:page_size],
90
- )
91
-
92
- @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
93
- end
94
-
95
- ##
96
- # When passed a block, yields FaxInstance records from the API.
97
- # This operation lazily loads records as efficiently as possible until the limit
98
- # is reached.
99
- def each
100
- limits = @version.read_limits
101
-
102
- page = self.page(page_size: limits[:page_size], )
103
-
104
- @version.stream(page,
105
- limit: limits[:limit],
106
- page_limit: limits[:page_limit]).each {|x| yield x}
107
- end
108
-
109
- ##
110
- # Retrieve a single page of FaxInstance records from the API.
111
- # Request is executed immediately.
112
- # @param [String] from Retrieve only those faxes sent from this phone number,
113
- # specified in {E.164}[https://www.twilio.com/docs/glossary/what-e164] format.
114
- # @param [String] to Retrieve only those faxes sent to this phone number,
115
- # specified in {E.164}[https://www.twilio.com/docs/glossary/what-e164] format.
116
- # @param [Time] date_created_on_or_before Retrieve only those faxes with a
117
- # `date_created` that is before or equal to this value, specified in {ISO
118
- # 8601}[https://en.wikipedia.org/wiki/ISO_8601] format.
119
- # @param [Time] date_created_after Retrieve only those faxes with a `date_created`
120
- # that is later than this value, specified in {ISO
121
- # 8601}[https://en.wikipedia.org/wiki/ISO_8601] format.
122
- # @param [String] page_token PageToken provided by the API
123
- # @param [Integer] page_number Page Number, this value is simply for client state
124
- # @param [Integer] page_size Number of records to return, defaults to 50
125
- # @return [Page] Page of FaxInstance
126
- def page(from: :unset, to: :unset, date_created_on_or_before: :unset, date_created_after: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
127
- params = Twilio::Values.of({
128
- 'From' => from,
129
- 'To' => to,
130
- 'DateCreatedOnOrBefore' => Twilio.serialize_iso8601_datetime(date_created_on_or_before),
131
- 'DateCreatedAfter' => Twilio.serialize_iso8601_datetime(date_created_after),
132
- 'PageToken' => page_token,
133
- 'Page' => page_number,
134
- 'PageSize' => page_size,
135
- })
136
-
137
- response = @version.page('GET', @uri, params: params)
138
-
139
- FaxPage.new(@version, response, @solution)
140
- end
141
-
142
- ##
143
- # Retrieve a single page of FaxInstance records from the API.
144
- # Request is executed immediately.
145
- # @param [String] target_url API-generated URL for the requested results page
146
- # @return [Page] Page of FaxInstance
147
- def get_page(target_url)
148
- response = @version.domain.request(
149
- 'GET',
150
- target_url
151
- )
152
- FaxPage.new(@version, response, @solution)
153
- end
154
-
155
- ##
156
- # Provide a user friendly representation
157
- def to_s
158
- '#<Twilio.Fax.V1.FaxList>'
159
- end
160
- end
161
-
162
- ##
163
- # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
164
- class FaxPage < Page
165
- ##
166
- # Initialize the FaxPage
167
- # @param [Version] version Version that contains the resource
168
- # @param [Response] response Response from the API
169
- # @param [Hash] solution Path solution for the resource
170
- # @return [FaxPage] FaxPage
171
- def initialize(version, response, solution)
172
- super(version, response)
173
-
174
- # Path Solution
175
- @solution = solution
176
- end
177
-
178
- ##
179
- # Build an instance of FaxInstance
180
- # @param [Hash] payload Payload response from the API
181
- # @return [FaxInstance] FaxInstance
182
- def get_instance(payload)
183
- FaxInstance.new(@version, payload, )
184
- end
185
-
186
- ##
187
- # Provide a user friendly representation
188
- def to_s
189
- '<Twilio.Fax.V1.FaxPage>'
190
- end
191
- end
192
-
193
- ##
194
- # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
195
- class FaxContext < InstanceContext
196
- ##
197
- # Initialize the FaxContext
198
- # @param [Version] version Version that contains the resource
199
- # @param [String] sid The Twilio-provided string that uniquely identifies the Fax
200
- # resource to fetch.
201
- # @return [FaxContext] FaxContext
202
- def initialize(version, sid)
203
- super(version)
204
-
205
- # Path Solution
206
- @solution = {sid: sid, }
207
- @uri = "/Faxes/#{@solution[:sid]}"
208
-
209
- # Dependents
210
- @media = nil
211
- end
212
-
213
- ##
214
- # Fetch the FaxInstance
215
- # @return [FaxInstance] Fetched FaxInstance
216
- def fetch
217
- payload = @version.fetch('GET', @uri)
218
-
219
- FaxInstance.new(@version, payload, sid: @solution[:sid], )
220
- end
221
-
222
- ##
223
- # Delete the FaxInstance
224
- # @return [Boolean] true if delete succeeds, false otherwise
225
- def delete
226
- @version.delete('DELETE', @uri)
227
- end
228
-
229
- ##
230
- # Access the media
231
- # @return [FaxMediaList]
232
- # @return [FaxMediaContext] if sid was passed.
233
- def media(sid=:unset)
234
- raise ArgumentError, 'sid cannot be nil' if sid.nil?
235
-
236
- if sid != :unset
237
- return FaxMediaContext.new(@version, @solution[:sid], sid, )
238
- end
239
-
240
- unless @media
241
- @media = FaxMediaList.new(@version, fax_sid: @solution[:sid], )
242
- end
243
-
244
- @media
245
- end
246
-
247
- ##
248
- # Provide a user friendly representation
249
- def to_s
250
- context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
251
- "#<Twilio.Fax.V1.FaxContext #{context}>"
252
- end
253
-
254
- ##
255
- # Provide a detailed, user friendly representation
256
- def inspect
257
- context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
258
- "#<Twilio.Fax.V1.FaxContext #{context}>"
259
- end
260
- end
261
-
262
- ##
263
- # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.
264
- class FaxInstance < InstanceResource
265
- ##
266
- # Initialize the FaxInstance
267
- # @param [Version] version Version that contains the resource
268
- # @param [Hash] payload payload that contains response from Twilio
269
- # @param [String] sid The Twilio-provided string that uniquely identifies the Fax
270
- # resource to fetch.
271
- # @return [FaxInstance] FaxInstance
272
- def initialize(version, payload, sid: nil)
273
- super(version)
274
-
275
- # Marshaled Properties
276
- @properties = {
277
- 'sid' => payload['sid'],
278
- 'account_sid' => payload['account_sid'],
279
- 'from' => payload['from'],
280
- 'to' => payload['to'],
281
- 'quality' => payload['quality'],
282
- 'media_sid' => payload['media_sid'],
283
- 'media_url' => payload['media_url'],
284
- 'num_pages' => payload['num_pages'] == nil ? payload['num_pages'] : payload['num_pages'].to_i,
285
- 'duration' => payload['duration'] == nil ? payload['duration'] : payload['duration'].to_i,
286
- 'status' => payload['status'],
287
- 'direction' => payload['direction'],
288
- 'api_version' => payload['api_version'],
289
- 'price' => payload['price'].to_f,
290
- 'price_unit' => payload['price_unit'],
291
- 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
292
- 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
293
- 'links' => payload['links'],
294
- 'url' => payload['url'],
295
- }
296
-
297
- # Context
298
- @instance_context = nil
299
- @params = {'sid' => sid || @properties['sid'], }
300
- end
301
-
302
- ##
303
- # Generate an instance context for the instance, the context is capable of
304
- # performing various actions. All instance actions are proxied to the context
305
- # @return [FaxContext] FaxContext for this FaxInstance
306
- def context
307
- unless @instance_context
308
- @instance_context = FaxContext.new(@version, @params['sid'], )
309
- end
310
- @instance_context
311
- end
312
-
313
- ##
314
- # @return [String] The unique string that identifies the resource
315
- def sid
316
- @properties['sid']
317
- end
318
-
319
- ##
320
- # @return [String] The SID of the Account that created the resource
321
- def account_sid
322
- @properties['account_sid']
323
- end
324
-
325
- ##
326
- # @return [String] The number the fax was sent from
327
- def from
328
- @properties['from']
329
- end
330
-
331
- ##
332
- # @return [String] The phone number that received the fax
333
- def to
334
- @properties['to']
335
- end
336
-
337
- ##
338
- # @return [fax.Quality] The quality of the fax
339
- def quality
340
- @properties['quality']
341
- end
342
-
343
- ##
344
- # @return [String] The SID of the FaxMedia resource that is associated with the Fax
345
- def media_sid
346
- @properties['media_sid']
347
- end
348
-
349
- ##
350
- # @return [String] The Twilio-hosted URL that can be used to download fax media
351
- def media_url
352
- @properties['media_url']
353
- end
354
-
355
- ##
356
- # @return [String] The number of pages contained in the fax document
357
- def num_pages
358
- @properties['num_pages']
359
- end
360
-
361
- ##
362
- # @return [String] The time it took to transmit the fax
363
- def duration
364
- @properties['duration']
365
- end
366
-
367
- ##
368
- # @return [fax.Status] The status of the fax
369
- def status
370
- @properties['status']
371
- end
372
-
373
- ##
374
- # @return [fax.Direction] The direction of the fax
375
- def direction
376
- @properties['direction']
377
- end
378
-
379
- ##
380
- # @return [String] The API version used to transmit the fax
381
- def api_version
382
- @properties['api_version']
383
- end
384
-
385
- ##
386
- # @return [String] The fax transmission price
387
- def price
388
- @properties['price']
389
- end
390
-
391
- ##
392
- # @return [String] The ISO 4217 currency used for billing
393
- def price_unit
394
- @properties['price_unit']
395
- end
396
-
397
- ##
398
- # @return [Time] The ISO 8601 formatted date and time in GMT when the resource was created
399
- def date_created
400
- @properties['date_created']
401
- end
402
-
403
- ##
404
- # @return [Time] The ISO 8601 formatted date and time in GMT when the resource was last updated
405
- def date_updated
406
- @properties['date_updated']
407
- end
408
-
409
- ##
410
- # @return [String] The URLs of the fax's related resources
411
- def links
412
- @properties['links']
413
- end
414
-
415
- ##
416
- # @return [String] The absolute URL of the fax resource
417
- def url
418
- @properties['url']
419
- end
420
-
421
- ##
422
- # Fetch the FaxInstance
423
- # @return [FaxInstance] Fetched FaxInstance
424
- def fetch
425
- context.fetch
426
- end
427
-
428
- ##
429
- # Delete the FaxInstance
430
- # @return [Boolean] true if delete succeeds, false otherwise
431
- def delete
432
- context.delete
433
- end
434
-
435
- ##
436
- # Access the media
437
- # @return [media] media
438
- def media
439
- context.media
440
- end
441
-
442
- ##
443
- # Provide a user friendly representation
444
- def to_s
445
- values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
446
- "<Twilio.Fax.V1.FaxInstance #{values}>"
447
- end
448
-
449
- ##
450
- # Provide a detailed, user friendly representation
451
- def inspect
452
- values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
453
- "<Twilio.Fax.V1.FaxInstance #{values}>"
454
- end
455
- end
456
- end
457
- end
458
- end
459
- end
@@ -1,45 +0,0 @@
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 Fax
12
- class V1 < Version
13
- ##
14
- # Initialize the V1 version of Fax
15
- def initialize(domain)
16
- super
17
- @version = 'v1'
18
- @faxes = nil
19
- end
20
-
21
- ##
22
- # @param [String] sid The Twilio-provided string that uniquely identifies the Fax
23
- # resource to fetch.
24
- # @return [Twilio::REST::Fax::V1::FaxContext] if sid was passed.
25
- # @return [Twilio::REST::Fax::V1::FaxList]
26
- def faxes(sid=:unset)
27
- if sid.nil?
28
- raise ArgumentError, 'sid cannot be nil'
29
- end
30
- if sid == :unset
31
- @faxes ||= FaxList.new self
32
- else
33
- FaxContext.new(self, sid)
34
- end
35
- end
36
-
37
- ##
38
- # Provide a user friendly representation
39
- def to_s
40
- '<Twilio::REST::Fax::V1>'
41
- end
42
- end
43
- end
44
- end
45
- end
@@ -1,47 +0,0 @@
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 Fax < Domain
12
- ##
13
- # Initialize the Fax Domain
14
- def initialize(twilio)
15
- super
16
-
17
- @base_url = 'https://fax.twilio.com'
18
- @host = 'fax.twilio.com'
19
- @port = 443
20
-
21
- # Versions
22
- @v1 = nil
23
- end
24
-
25
- ##
26
- # Version v1 of fax
27
- def v1
28
- @v1 ||= V1.new self
29
- end
30
-
31
- ##
32
- # @param [String] sid The unique string that we created to identify the Fax
33
- # resource.
34
- # @return [Twilio::REST::Fax::V1::FaxInstance] if sid was passed.
35
- # @return [Twilio::REST::Fax::V1::FaxList]
36
- def faxes(sid=:unset)
37
- self.v1.faxes(sid)
38
- end
39
-
40
- ##
41
- # Provide a user friendly representation
42
- def to_s
43
- '#<Twilio::REST::Fax>'
44
- end
45
- end
46
- end
47
- end