twilio-ruby 5.69.0 → 5.71.0

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.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +43 -1
  3. data/Makefile +6 -2
  4. data/README.md +2 -2
  5. data/lib/twilio-ruby/rest/api/v2010/account/sip/ip_access_control_list/ip_address.rb +4 -4
  6. data/lib/twilio-ruby/rest/api/v2010/account/sip/ip_access_control_list.rb +3 -3
  7. data/lib/twilio-ruby/rest/client.rb +14 -0
  8. data/lib/twilio-ruby/rest/flex_api/v1/interaction/interaction_channel.rb +22 -1
  9. data/lib/twilio-ruby/rest/media/v1/player_streamer.rb +4 -4
  10. data/lib/twilio-ruby/rest/messaging/v1/service/alpha_sender.rb +2 -2
  11. data/lib/twilio-ruby/rest/microvisor/v1/app.rb +305 -0
  12. data/lib/twilio-ruby/rest/microvisor/v1/device.rb +332 -0
  13. data/lib/twilio-ruby/rest/microvisor/v1.rb +60 -0
  14. data/lib/twilio-ruby/rest/microvisor.rb +54 -0
  15. data/lib/twilio-ruby/rest/preview.rb +0 -25
  16. data/lib/twilio-ruby/rest/routes/v2/phone_number.rb +235 -0
  17. data/lib/twilio-ruby/rest/routes/v2/sip_domain.rb +231 -0
  18. data/lib/twilio-ruby/rest/routes/v2/trunk.rb +235 -0
  19. data/lib/twilio-ruby/rest/routes/v2.rb +76 -0
  20. data/lib/twilio-ruby/rest/routes.rb +62 -0
  21. data/lib/twilio-ruby/rest/supersim/v1/fleet.rb +16 -6
  22. data/lib/twilio-ruby/rest/verify/v2/service/verification.rb +7 -8
  23. data/lib/twilio-ruby/rest/verify/v2/service/verification_check.rb +10 -3
  24. data/lib/twilio-ruby/security/request_validator.rb +1 -1
  25. data/lib/twilio-ruby/version.rb +1 -1
  26. metadata +11 -8
  27. data/lib/twilio-ruby/rest/preview/bulk_exports/export/day.rb +0 -294
  28. data/lib/twilio-ruby/rest/preview/bulk_exports/export/export_custom_job.rb +0 -275
  29. data/lib/twilio-ruby/rest/preview/bulk_exports/export/job.rb +0 -249
  30. data/lib/twilio-ruby/rest/preview/bulk_exports/export.rb +0 -251
  31. data/lib/twilio-ruby/rest/preview/bulk_exports/export_configuration.rb +0 -234
  32. data/lib/twilio-ruby/rest/preview/bulk_exports.rb +0 -62
@@ -0,0 +1,76 @@
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 Routes
12
+ class V2 < Version
13
+ ##
14
+ # Initialize the V2 version of Routes
15
+ def initialize(domain)
16
+ super
17
+ @version = 'v2'
18
+ @phone_numbers = nil
19
+ @sip_domains = nil
20
+ @trunks = nil
21
+ end
22
+
23
+ ##
24
+ # @param [String] phone_number The phone number in E.164 format
25
+ # @return [Twilio::REST::Routes::V2::PhoneNumberContext] if phone_number was passed.
26
+ # @return [Twilio::REST::Routes::V2::PhoneNumberList]
27
+ def phone_numbers(phone_number=:unset)
28
+ if phone_number.nil?
29
+ raise ArgumentError, 'phone_number cannot be nil'
30
+ end
31
+ if phone_number == :unset
32
+ @phone_numbers ||= PhoneNumberList.new self
33
+ else
34
+ PhoneNumberContext.new(self, phone_number)
35
+ end
36
+ end
37
+
38
+ ##
39
+ # @param [String] sip_domain The sip_domain
40
+ # @return [Twilio::REST::Routes::V2::SipDomainContext] if sip_domain was passed.
41
+ # @return [Twilio::REST::Routes::V2::SipDomainList]
42
+ def sip_domains(sip_domain=:unset)
43
+ if sip_domain.nil?
44
+ raise ArgumentError, 'sip_domain cannot be nil'
45
+ end
46
+ if sip_domain == :unset
47
+ @sip_domains ||= SipDomainList.new self
48
+ else
49
+ SipDomainContext.new(self, sip_domain)
50
+ end
51
+ end
52
+
53
+ ##
54
+ # @param [String] sip_trunk_domain The absolute URL of the SIP Trunk
55
+ # @return [Twilio::REST::Routes::V2::TrunkContext] if sip_trunk_domain was passed.
56
+ # @return [Twilio::REST::Routes::V2::TrunkList]
57
+ def trunks(sip_trunk_domain=:unset)
58
+ if sip_trunk_domain.nil?
59
+ raise ArgumentError, 'sip_trunk_domain cannot be nil'
60
+ end
61
+ if sip_trunk_domain == :unset
62
+ @trunks ||= TrunkList.new self
63
+ else
64
+ TrunkContext.new(self, sip_trunk_domain)
65
+ end
66
+ end
67
+
68
+ ##
69
+ # Provide a user friendly representation
70
+ def to_s
71
+ '<Twilio::REST::Routes::V2>'
72
+ end
73
+ end
74
+ end
75
+ end
76
+ end
@@ -0,0 +1,62 @@
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 Routes < Domain
12
+ ##
13
+ # Initialize the Routes Domain
14
+ def initialize(twilio)
15
+ super
16
+
17
+ @base_url = 'https://routes.twilio.com'
18
+ @host = 'routes.twilio.com'
19
+ @port = 443
20
+
21
+ # Versions
22
+ @v2 = nil
23
+ end
24
+
25
+ ##
26
+ # Version v2 of routes
27
+ def v2
28
+ @v2 ||= V2.new self
29
+ end
30
+
31
+ ##
32
+ # @param [String] phone_number The phone number in E.164 format
33
+ # @return [Twilio::REST::Routes::V2::PhoneNumberInstance] if phone_number was passed.
34
+ # @return [Twilio::REST::Routes::V2::PhoneNumberList]
35
+ def phone_numbers(phone_number=:unset)
36
+ self.v2.phone_numbers(phone_number)
37
+ end
38
+
39
+ ##
40
+ # @param [String] sip_domain The sip_domain
41
+ # @return [Twilio::REST::Routes::V2::SipDomainInstance] if sip_domain was passed.
42
+ # @return [Twilio::REST::Routes::V2::SipDomainList]
43
+ def sip_domains(sip_domain=:unset)
44
+ self.v2.sip_domains(sip_domain)
45
+ end
46
+
47
+ ##
48
+ # @param [String] sip_trunk_domain The absolute URL of the SIP Trunk
49
+ # @return [Twilio::REST::Routes::V2::TrunkInstance] if sip_trunk_domain was passed.
50
+ # @return [Twilio::REST::Routes::V2::TrunkList]
51
+ def trunks(sip_trunk_domain=:unset)
52
+ self.v2.trunks(sip_trunk_domain)
53
+ end
54
+
55
+ ##
56
+ # Provide a user friendly representation
57
+ def to_s
58
+ '#<Twilio::REST::Routes>'
59
+ end
60
+ end
61
+ end
62
+ end
@@ -36,9 +36,9 @@ module Twilio
36
36
  # @param [Boolean] data_enabled Defines whether SIMs in the Fleet are capable of
37
37
  # using 2G/3G/4G/LTE/CAT-M data connectivity. Defaults to `true`.
38
38
  # @param [String] data_limit The total data usage (download and upload combined)
39
- # in Megabytes that each Sim resource assigned to the Fleet resource can consume
40
- # during a billing period (normally one month). Value must be between 1MB (1) and
41
- # 2TB (2,000,000). Defaults to 1GB (1,000).
39
+ # in Megabytes that each Super SIM assigned to the Fleet can consume during a
40
+ # billing period (normally one month). Value must be between 1MB (1) and 2TB
41
+ # (2,000,000). Defaults to 1GB (1,000).
42
42
  # @param [String] ip_commands_url The URL that will receive a webhook when a Super
43
43
  # SIM in the Fleet is used to send an IP Command from your device to a special IP
44
44
  # address. Your server should respond with an HTTP status code in the 200 range;
@@ -254,8 +254,12 @@ module Twilio
254
254
  # @param [String] sms_commands_method A string representing the HTTP method to use
255
255
  # when making a request to `sms_commands_url`. Can be one of `POST` or `GET`.
256
256
  # Defaults to `POST`.
257
+ # @param [String] data_limit The total data usage (download and upload combined)
258
+ # in Megabytes that each Super SIM assigned to the Fleet can consume during a
259
+ # billing period (normally one month). Value must be between 1MB (1) and 2TB
260
+ # (2,000,000). Defaults to 1GB (1,000).
257
261
  # @return [FleetInstance] Updated FleetInstance
258
- def update(unique_name: :unset, network_access_profile: :unset, ip_commands_url: :unset, ip_commands_method: :unset, sms_commands_url: :unset, sms_commands_method: :unset)
262
+ def update(unique_name: :unset, network_access_profile: :unset, ip_commands_url: :unset, ip_commands_method: :unset, sms_commands_url: :unset, sms_commands_method: :unset, data_limit: :unset)
259
263
  data = Twilio::Values.of({
260
264
  'UniqueName' => unique_name,
261
265
  'NetworkAccessProfile' => network_access_profile,
@@ -263,6 +267,7 @@ module Twilio
263
267
  'IpCommandsMethod' => ip_commands_method,
264
268
  'SmsCommandsUrl' => sms_commands_url,
265
269
  'SmsCommandsMethod' => sms_commands_method,
270
+ 'DataLimit' => data_limit,
266
271
  })
267
272
 
268
273
  payload = @version.update('POST', @uri, data: data)
@@ -375,7 +380,7 @@ module Twilio
375
380
  end
376
381
 
377
382
  ##
378
- # @return [String] The total data usage (download and upload combined) in Megabytes that each Sim resource assigned to the Fleet resource can consume
383
+ # @return [String] The total data usage (download and upload combined) in Megabytes that each Super SIM assigned to the Fleet can consume
379
384
  def data_limit
380
385
  @properties['data_limit']
381
386
  end
@@ -451,8 +456,12 @@ module Twilio
451
456
  # @param [String] sms_commands_method A string representing the HTTP method to use
452
457
  # when making a request to `sms_commands_url`. Can be one of `POST` or `GET`.
453
458
  # Defaults to `POST`.
459
+ # @param [String] data_limit The total data usage (download and upload combined)
460
+ # in Megabytes that each Super SIM assigned to the Fleet can consume during a
461
+ # billing period (normally one month). Value must be between 1MB (1) and 2TB
462
+ # (2,000,000). Defaults to 1GB (1,000).
454
463
  # @return [FleetInstance] Updated FleetInstance
455
- def update(unique_name: :unset, network_access_profile: :unset, ip_commands_url: :unset, ip_commands_method: :unset, sms_commands_url: :unset, sms_commands_method: :unset)
464
+ def update(unique_name: :unset, network_access_profile: :unset, ip_commands_url: :unset, ip_commands_method: :unset, sms_commands_url: :unset, sms_commands_method: :unset, data_limit: :unset)
456
465
  context.update(
457
466
  unique_name: unique_name,
458
467
  network_access_profile: network_access_profile,
@@ -460,6 +469,7 @@ module Twilio
460
469
  ip_commands_method: ip_commands_method,
461
470
  sms_commands_url: sms_commands_url,
462
471
  sms_commands_method: sms_commands_method,
472
+ data_limit: data_limit,
463
473
  )
464
474
  end
465
475
 
@@ -32,9 +32,9 @@ module Twilio
32
32
  # @param [String] to The phone number or
33
33
  # {email}[https://www.twilio.com/docs/verify/email] to verify. Phone numbers must
34
34
  # be in {E.164 format}[https://www.twilio.com/docs/glossary/what-e164].
35
- # @param [String] channel The verification method to use. Can be:
36
- # {`email`}[https://www.twilio.com/docs/verify/email], `sms`, `whatsapp` or
37
- # `call`.
35
+ # @param [String] channel The verification method to use. One of:
36
+ # {`email`}[https://www.twilio.com/docs/verify/email], `sms`, `whatsapp`, `call`,
37
+ # or `sna`.
38
38
  # @param [String] custom_friendly_name A custom user defined friendly name that
39
39
  # overwrites the existing one in the verification message
40
40
  # @param [String] custom_message The text of a custom message to use for the
@@ -43,11 +43,10 @@ module Twilio
43
43
  # for example, to dial an extension. For more information, see the Programmable
44
44
  # Voice documentation of
45
45
  # {sendDigits}[https://www.twilio.com/docs/voice/twiml/number#attributes-sendDigits].
46
- # @param [String] locale The locale to use for the verification SMS, WhatsApp or
47
- # call. Can be: `af`, `ar`, `ca`, `cs`, `da`, `de`, `el`, `en`, `en-GB`, `es`,
48
- # `fi`, `fr`, `he`, `hi`, `hr`, `hu`, `id`, `it`, `ja`, `ko`, `ms`, `nb`, `nl`,
49
- # `pl`, `pt`, `pr-BR`, `ro`, `ru`, `sv`, `th`, `tl`, `tr`, `vi`, `zh`, `zh-CN`, or
50
- # `zh-HK.`
46
+ # @param [String] locale Locale will automatically resolve based on phone number
47
+ # country code for SMS, WhatsApp and call channel verifications. This parameter
48
+ # will override the automatic locale. {See supported languages and more
49
+ # information here.}[https://www.twilio.com/docs/verify/supported-languages].
51
50
  # @param [String] custom_code A pre-generated code to use for verification. The
52
51
  # code can be between 4 and 10 characters, inclusive.
53
52
  # @param [String] amount The amount of the associated PSD2 compliant transaction.
@@ -29,6 +29,7 @@ module Twilio
29
29
 
30
30
  ##
31
31
  # Create the VerificationCheckInstance
32
+ # @param [String] code The 4-10 character string being verified.
32
33
  # @param [String] to The phone number or
33
34
  # {email}[https://www.twilio.com/docs/verify/email] to verify. Either this
34
35
  # parameter or the `verification_sid` must be specified. Phone numbers must be in
@@ -40,15 +41,14 @@ module Twilio
40
41
  # Requires the PSD2 Service flag enabled.
41
42
  # @param [String] payee The payee of the associated PSD2 compliant transaction.
42
43
  # Requires the PSD2 Service flag enabled.
43
- # @param [String] code The 4-10 character string being verified.
44
44
  # @return [VerificationCheckInstance] Created VerificationCheckInstance
45
- def create(to: :unset, verification_sid: :unset, amount: :unset, payee: :unset, code: :unset)
45
+ def create(code: :unset, to: :unset, verification_sid: :unset, amount: :unset, payee: :unset)
46
46
  data = Twilio::Values.of({
47
+ 'Code' => code,
47
48
  'To' => to,
48
49
  'VerificationSid' => verification_sid,
49
50
  'Amount' => amount,
50
51
  'Payee' => payee,
51
- 'Code' => code,
52
52
  })
53
53
 
54
54
  payload = @version.create('POST', @uri, data: data)
@@ -117,6 +117,7 @@ module Twilio
117
117
  'payee' => payload['payee'],
118
118
  'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
119
119
  'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
120
+ 'sna_attempts_error_codes' => payload['sna_attempts_error_codes'],
120
121
  }
121
122
  end
122
123
 
@@ -186,6 +187,12 @@ module Twilio
186
187
  @properties['date_updated']
187
188
  end
188
189
 
190
+ ##
191
+ # @return [Array[Hash]] List of error codes as a result of attempting a verification using the `sna` channel.
192
+ def sna_attempts_error_codes
193
+ @properties['sna_attempts_error_codes']
194
+ end
195
+
189
196
  ##
190
197
  # Provide a user friendly representation
191
198
  def to_s
@@ -32,7 +32,7 @@ module Twilio
32
32
  valid_body = true # default succeed, since body not always provided
33
33
  params_hash = body_or_hash(params)
34
34
  unless params_hash.is_a? Enumerable
35
- body_hash = URI.decode_www_form(parsed_url.query).to_h['bodySHA256']
35
+ body_hash = URI.decode_www_form(parsed_url.query || '').to_h['bodySHA256']
36
36
  params_hash = build_hash_for(params)
37
37
  valid_body = !(params_hash.nil? || body_hash.nil?) && secure_compare(params_hash, body_hash)
38
38
  params_hash = {}
@@ -1,3 +1,3 @@
1
1
  module Twilio
2
- VERSION = '5.69.0'
2
+ VERSION = '5.71.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: twilio-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.69.0
4
+ version: 5.71.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Twilio API Team
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-13 00:00:00.000000000 Z
11
+ date: 2022-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jwt
@@ -492,6 +492,10 @@ files:
492
492
  - lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb
493
493
  - lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person_usecase.rb
494
494
  - lib/twilio-ruby/rest/messaging/v1/usecase.rb
495
+ - lib/twilio-ruby/rest/microvisor.rb
496
+ - lib/twilio-ruby/rest/microvisor/v1.rb
497
+ - lib/twilio-ruby/rest/microvisor/v1/app.rb
498
+ - lib/twilio-ruby/rest/microvisor/v1/device.rb
495
499
  - lib/twilio-ruby/rest/monitor.rb
496
500
  - lib/twilio-ruby/rest/monitor/v1.rb
497
501
  - lib/twilio-ruby/rest/monitor/v1/alert.rb
@@ -516,12 +520,6 @@ files:
516
520
  - lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/supporting_document.rb
517
521
  - lib/twilio-ruby/rest/numbers/v2/regulatory_compliance/supporting_document_type.rb
518
522
  - lib/twilio-ruby/rest/preview.rb
519
- - lib/twilio-ruby/rest/preview/bulk_exports.rb
520
- - lib/twilio-ruby/rest/preview/bulk_exports/export.rb
521
- - lib/twilio-ruby/rest/preview/bulk_exports/export/day.rb
522
- - lib/twilio-ruby/rest/preview/bulk_exports/export/export_custom_job.rb
523
- - lib/twilio-ruby/rest/preview/bulk_exports/export/job.rb
524
- - lib/twilio-ruby/rest/preview/bulk_exports/export_configuration.rb
525
523
  - lib/twilio-ruby/rest/preview/deployed_devices.rb
526
524
  - lib/twilio-ruby/rest/preview/deployed_devices/fleet.rb
527
525
  - lib/twilio-ruby/rest/preview/deployed_devices/fleet/certificate.rb
@@ -597,6 +595,11 @@ files:
597
595
  - lib/twilio-ruby/rest/proxy/v1/service/session/participant.rb
598
596
  - lib/twilio-ruby/rest/proxy/v1/service/session/participant/message_interaction.rb
599
597
  - lib/twilio-ruby/rest/proxy/v1/service/short_code.rb
598
+ - lib/twilio-ruby/rest/routes.rb
599
+ - lib/twilio-ruby/rest/routes/v2.rb
600
+ - lib/twilio-ruby/rest/routes/v2/phone_number.rb
601
+ - lib/twilio-ruby/rest/routes/v2/sip_domain.rb
602
+ - lib/twilio-ruby/rest/routes/v2/trunk.rb
600
603
  - lib/twilio-ruby/rest/serverless.rb
601
604
  - lib/twilio-ruby/rest/serverless/v1.rb
602
605
  - lib/twilio-ruby/rest/serverless/v1/service.rb
@@ -1,294 +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 Preview < Domain
12
- class BulkExports < Version
13
- class ExportContext < InstanceContext
14
- ##
15
- # PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
16
- class DayList < ListResource
17
- ##
18
- # Initialize the DayList
19
- # @param [Version] version Version that contains the resource
20
- # @param [String] resource_type The type of communication – Messages, Calls,
21
- # Conferences, and Participants
22
- # @return [DayList] DayList
23
- def initialize(version, resource_type: nil)
24
- super(version)
25
-
26
- # Path Solution
27
- @solution = {resource_type: resource_type}
28
- @uri = "/Exports/#{@solution[:resource_type]}/Days"
29
- end
30
-
31
- ##
32
- # Lists DayInstance records from the API as a list.
33
- # Unlike stream(), this operation is eager and will load `limit` records into
34
- # memory before returning.
35
- # @param [Integer] limit Upper limit for the number of records to return. stream()
36
- # guarantees to never return more than limit. Default is no limit
37
- # @param [Integer] page_size Number of records to fetch per request, when
38
- # not set will use the default value of 50 records. If no page_size is defined
39
- # but a limit is defined, stream() will attempt to read the limit with the most
40
- # efficient page size, i.e. min(limit, 1000)
41
- # @return [Array] Array of up to limit results
42
- def list(limit: nil, page_size: nil)
43
- self.stream(limit: limit, page_size: page_size).entries
44
- end
45
-
46
- ##
47
- # Streams DayInstance records from the API as an Enumerable.
48
- # This operation lazily loads records as efficiently as possible until the limit
49
- # is reached.
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 [Enumerable] Enumerable that will yield up to limit results
57
- def stream(limit: nil, page_size: nil)
58
- limits = @version.read_limits(limit, page_size)
59
-
60
- page = self.page(page_size: limits[:page_size], )
61
-
62
- @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
63
- end
64
-
65
- ##
66
- # When passed a block, yields DayInstance records from the API.
67
- # This operation lazily loads records as efficiently as possible until the limit
68
- # is reached.
69
- def each
70
- limits = @version.read_limits
71
-
72
- page = self.page(page_size: limits[:page_size], )
73
-
74
- @version.stream(page,
75
- limit: limits[:limit],
76
- page_limit: limits[:page_limit]).each {|x| yield x}
77
- end
78
-
79
- ##
80
- # Retrieve a single page of DayInstance records from the API.
81
- # Request is executed immediately.
82
- # @param [String] page_token PageToken provided by the API
83
- # @param [Integer] page_number Page Number, this value is simply for client state
84
- # @param [Integer] page_size Number of records to return, defaults to 50
85
- # @return [Page] Page of DayInstance
86
- def page(page_token: :unset, page_number: :unset, page_size: :unset)
87
- params = Twilio::Values.of({
88
- 'PageToken' => page_token,
89
- 'Page' => page_number,
90
- 'PageSize' => page_size,
91
- })
92
-
93
- response = @version.page('GET', @uri, params: params)
94
-
95
- DayPage.new(@version, response, @solution)
96
- end
97
-
98
- ##
99
- # Retrieve a single page of DayInstance records from the API.
100
- # Request is executed immediately.
101
- # @param [String] target_url API-generated URL for the requested results page
102
- # @return [Page] Page of DayInstance
103
- def get_page(target_url)
104
- response = @version.domain.request(
105
- 'GET',
106
- target_url
107
- )
108
- DayPage.new(@version, response, @solution)
109
- end
110
-
111
- ##
112
- # Provide a user friendly representation
113
- def to_s
114
- '#<Twilio.Preview.BulkExports.DayList>'
115
- end
116
- end
117
-
118
- ##
119
- # PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
120
- class DayPage < Page
121
- ##
122
- # Initialize the DayPage
123
- # @param [Version] version Version that contains the resource
124
- # @param [Response] response Response from the API
125
- # @param [Hash] solution Path solution for the resource
126
- # @return [DayPage] DayPage
127
- def initialize(version, response, solution)
128
- super(version, response)
129
-
130
- # Path Solution
131
- @solution = solution
132
- end
133
-
134
- ##
135
- # Build an instance of DayInstance
136
- # @param [Hash] payload Payload response from the API
137
- # @return [DayInstance] DayInstance
138
- def get_instance(payload)
139
- DayInstance.new(@version, payload, resource_type: @solution[:resource_type], )
140
- end
141
-
142
- ##
143
- # Provide a user friendly representation
144
- def to_s
145
- '<Twilio.Preview.BulkExports.DayPage>'
146
- end
147
- end
148
-
149
- ##
150
- # PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
151
- class DayContext < InstanceContext
152
- ##
153
- # Initialize the DayContext
154
- # @param [Version] version Version that contains the resource
155
- # @param [String] resource_type The type of communication – Messages, Calls,
156
- # Conferences, and Participants
157
- # @param [String] day The ISO 8601 format date of the resources in the file, for a
158
- # UTC day
159
- # @return [DayContext] DayContext
160
- def initialize(version, resource_type, day)
161
- super(version)
162
-
163
- # Path Solution
164
- @solution = {resource_type: resource_type, day: day, }
165
- @uri = "/Exports/#{@solution[:resource_type]}/Days/#{@solution[:day]}"
166
- end
167
-
168
- ##
169
- # Fetch the DayInstance
170
- # @return [DayInstance] Fetched DayInstance
171
- def fetch
172
- payload = @version.fetch('GET', @uri)
173
-
174
- DayInstance.new(@version, payload, resource_type: @solution[:resource_type], day: @solution[:day], )
175
- end
176
-
177
- ##
178
- # Provide a user friendly representation
179
- def to_s
180
- context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
181
- "#<Twilio.Preview.BulkExports.DayContext #{context}>"
182
- end
183
-
184
- ##
185
- # Provide a detailed, user friendly representation
186
- def inspect
187
- context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
188
- "#<Twilio.Preview.BulkExports.DayContext #{context}>"
189
- end
190
- end
191
-
192
- ##
193
- # PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
194
- class DayInstance < InstanceResource
195
- ##
196
- # Initialize the DayInstance
197
- # @param [Version] version Version that contains the resource
198
- # @param [Hash] payload payload that contains response from Twilio
199
- # @param [String] resource_type The type of communication – Messages, Calls,
200
- # Conferences, and Participants
201
- # @param [String] day The ISO 8601 format date of the resources in the file, for a
202
- # UTC day
203
- # @return [DayInstance] DayInstance
204
- def initialize(version, payload, resource_type: nil, day: nil)
205
- super(version)
206
-
207
- # Marshaled Properties
208
- @properties = {
209
- 'redirect_to' => payload['redirect_to'],
210
- 'day' => payload['day'],
211
- 'size' => payload['size'].to_i,
212
- 'create_date' => payload['create_date'],
213
- 'friendly_name' => payload['friendly_name'],
214
- 'resource_type' => payload['resource_type'],
215
- }
216
-
217
- # Context
218
- @instance_context = nil
219
- @params = {'resource_type' => resource_type, 'day' => day || @properties['day'], }
220
- end
221
-
222
- ##
223
- # Generate an instance context for the instance, the context is capable of
224
- # performing various actions. All instance actions are proxied to the context
225
- # @return [DayContext] DayContext for this DayInstance
226
- def context
227
- unless @instance_context
228
- @instance_context = DayContext.new(@version, @params['resource_type'], @params['day'], )
229
- end
230
- @instance_context
231
- end
232
-
233
- ##
234
- # @return [String] The redirect_to
235
- def redirect_to
236
- @properties['redirect_to']
237
- end
238
-
239
- ##
240
- # @return [String] The date of the data in the file
241
- def day
242
- @properties['day']
243
- end
244
-
245
- ##
246
- # @return [String] Size of the file in bytes
247
- def size
248
- @properties['size']
249
- end
250
-
251
- ##
252
- # @return [String] The date when resource is created
253
- def create_date
254
- @properties['create_date']
255
- end
256
-
257
- ##
258
- # @return [String] The friendly name specified when creating the job
259
- def friendly_name
260
- @properties['friendly_name']
261
- end
262
-
263
- ##
264
- # @return [String] The type of communication – Messages, Calls, Conferences, and Participants
265
- def resource_type
266
- @properties['resource_type']
267
- end
268
-
269
- ##
270
- # Fetch the DayInstance
271
- # @return [DayInstance] Fetched DayInstance
272
- def fetch
273
- context.fetch
274
- end
275
-
276
- ##
277
- # Provide a user friendly representation
278
- def to_s
279
- values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
280
- "<Twilio.Preview.BulkExports.DayInstance #{values}>"
281
- end
282
-
283
- ##
284
- # Provide a detailed, user friendly representation
285
- def inspect
286
- values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
287
- "<Twilio.Preview.BulkExports.DayInstance #{values}>"
288
- end
289
- end
290
- end
291
- end
292
- end
293
- end
294
- end