twilio-ruby 5.66.2 → 5.67.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1920b33b39b09bf234cd20e91aebff55c3883bcc
4
- data.tar.gz: b0abb17c32b875c50001e4bf8e024f655bb395c7
3
+ metadata.gz: 7701af5fb4015c43f3cb33005487afe3b041e183
4
+ data.tar.gz: ecdf6d5493148b024f336215e37d63b7f81e8bcd
5
5
  SHA512:
6
- metadata.gz: aca67e15af03fee97418c118c81bddd84148ef497b23a59bc4a09bfdc97387d9779b972ca53c8fa431aefb74bb5f7149682b56295183536f9f8795107e83b13a
7
- data.tar.gz: 59ce3eec9ba1be93a2e97ef6521656f97af26b6763103c5b8389d927acb9c210328e5f4371f8d2500247ef5caa176a72c13c76ee130d85a4435152665eed87e5
6
+ metadata.gz: 9bcaa3d09a723a6093c8f108c6b3104c66751ca3ccc6c159f88fcd34311b77a6695ea2c7a01ea58136569daae4984cb9f607e34db53b094a8e5b339f5630e9ff
7
+ data.tar.gz: 7ca90f7c1ef070172105178679e1f05ed6f05570b4f8f12437788f8eaa1c333499444aee475f69033fe1411977d5573a1d03c32fae22eb67cacc3d2f6273749a
@@ -1,7 +1,7 @@
1
1
  name: Lint PR
2
2
  on:
3
3
  pull_request_target:
4
- types: [ opened, edited, reopened ]
4
+ types: [ opened, edited, synchronize, reopened ]
5
5
 
6
6
  jobs:
7
7
  validate:
data/CHANGES.md CHANGED
@@ -1,6 +1,27 @@
1
1
  twilio-ruby changelog
2
2
  =====================
3
3
 
4
+ [2022-05-04] Version 5.67.0
5
+ ---------------------------
6
+ **Library - Fix**
7
+ - [PR #607](https://github.com/twilio/twilio-ruby/pull/607): Retrieval of OS Info with Ruby Config for User Agent string. Thanks to [@claudiachua](https://github.com/claudiachua)!
8
+ - [PR #606](https://github.com/twilio/twilio-ruby/pull/606): Only require twilio_webhook_authentication if Rack version > 2. Thanks to [@jasonnoble](https://github.com/jasonnoble)!
9
+ - [PR #582](https://github.com/twilio/twilio-ruby/pull/582): avoid JSON::ParserError for all server errors. Thanks to [@dan-jensen](https://github.com/dan-jensen)!
10
+
11
+ **Library - Feature**
12
+ - [PR #591](https://github.com/twilio/twilio-ruby/pull/591): Add Faraday 2.0 support. Thanks to [@tconst](https://github.com/tconst)!
13
+
14
+ **Conversations**
15
+ - Expose query parameter `type` in list operation on Address Configurations resource
16
+
17
+ **Supersim**
18
+ - Add `data_total_billed` and `billed_units` fields to Super SIM UsageRecords API response.
19
+ - Change ESimProfiles `Eid` parameter to optional to enable Activation Code download method support **(breaking change)**
20
+
21
+ **Verify**
22
+ - Deprecate `push.include_date` parameter in create and update service.
23
+
24
+
4
25
  [2022-04-20] Version 5.66.2
5
26
  ---------------------------
6
27
  **Library - Chore**
data/README.md CHANGED
@@ -34,13 +34,13 @@ This library supports the following Ruby implementations:
34
34
  To install using [Bundler][bundler] grab the latest stable version:
35
35
 
36
36
  ```ruby
37
- gem 'twilio-ruby', '~> 5.66.2'
37
+ gem 'twilio-ruby', '~> 5.67.0'
38
38
  ```
39
39
 
40
40
  To manually install `twilio-ruby` via [Rubygems][rubygems] simply gem install:
41
41
 
42
42
  ```bash
43
- gem install twilio-ruby -v 5.66.2
43
+ gem install twilio-ruby -v 5.67.0
44
44
  ```
45
45
 
46
46
  To build and install the development branch yourself from the latest source:
@@ -26,12 +26,16 @@ module Twilio
26
26
  nil
27
27
  end
28
28
 
29
- def _request(request)
29
+ def _request(request) # rubocop:disable Metrics/MethodLength
30
30
  @connection = Faraday.new(url: request.host + ':' + request.port.to_s, ssl: { verify: true }) do |f|
31
31
  f.options.params_encoder = Faraday::FlatParamsEncoder
32
32
  f.request :url_encoded
33
33
  f.headers = request.headers
34
- f.request(:basic_auth, request.auth[0], request.auth[1])
34
+ if Faraday::VERSION.start_with?('2.')
35
+ f.request(:authorization, :basic, request.auth[0], request.auth[1])
36
+ else
37
+ f.request(:basic_auth, request.auth[0], request.auth[1])
38
+ end
35
39
  f.proxy = "#{@proxy_prot}://#{@proxy_auth}#{@proxy_path}" if @proxy_prot && @proxy_path
36
40
  f.options.open_timeout = request.timeout || @timeout
37
41
  f.options.timeout = request.timeout || @timeout
@@ -44,8 +48,8 @@ module Twilio
44
48
  @last_response = nil
45
49
 
46
50
  response = send(request)
47
- if response.status == 504
48
- object = { message: 'Request timeout', code: 504 }.to_json
51
+ if (500..599).include?(response.status)
52
+ object = { message: "Server error (#{response.status})", code: response.status }.to_json
49
53
  elsif response.body && !response.body.empty?
50
54
  object = response.body
51
55
  elsif response.status == 400
@@ -83,8 +83,7 @@ module Twilio
83
83
  # @param [Time] send_at The time that Twilio will send the message. Must be in ISO
84
84
  # 8601 format.
85
85
  # @param [Boolean] send_as_mms If set to True, Twilio will deliver the message as
86
- # a single MMS message, regardless of the presence of media. This is a Beta
87
- # Feature.
86
+ # a single MMS message, regardless of the presence of media.
88
87
  # @param [String] from A Twilio phone number in
89
88
  # {E.164}[https://www.twilio.com/docs/glossary/what-e164] format, an {alphanumeric
90
89
  # sender
@@ -70,7 +70,8 @@ module Twilio
70
70
  def request(host, port, method, uri, params={}, data={}, headers={}, auth=nil, timeout=nil)
71
71
  auth ||= @auth
72
72
 
73
- headers['User-Agent'] = "twilio-ruby/#{Twilio::VERSION} (#{`uname -s`.chomp} #{`uname -m`.chomp}) Ruby/#{RUBY_VERSION}"
73
+ ruby_config = RbConfig::CONFIG
74
+ headers['User-Agent'] = "twilio-ruby/#{Twilio::VERSION} (#{ruby_config["host_os"]} #{ruby_config["host_cpu"]}) Ruby/#{RUBY_VERSION}"
74
75
  headers['Accept-Charset'] = 'utf-8'
75
76
 
76
77
  user_agent_extensions.each { |extension| headers['User-Agent'] += " #{extension}" }
@@ -27,6 +27,8 @@ module Twilio
27
27
  # Lists AddressConfigurationInstance records from the API as a list.
28
28
  # Unlike stream(), this operation is eager and will load `limit` records into
29
29
  # memory before returning.
30
+ # @param [String] type Filter the address configurations by its type. This value
31
+ # can be one of: `whatsapp`, `sms`.
30
32
  # @param [Integer] limit Upper limit for the number of records to return. stream()
31
33
  # guarantees to never return more than limit. Default is no limit
32
34
  # @param [Integer] page_size Number of records to fetch per request, when
@@ -34,14 +36,16 @@ module Twilio
34
36
  # but a limit is defined, stream() will attempt to read the limit with the most
35
37
  # efficient page size, i.e. min(limit, 1000)
36
38
  # @return [Array] Array of up to limit results
37
- def list(limit: nil, page_size: nil)
38
- self.stream(limit: limit, page_size: page_size).entries
39
+ def list(type: :unset, limit: nil, page_size: nil)
40
+ self.stream(type: type, limit: limit, page_size: page_size).entries
39
41
  end
40
42
 
41
43
  ##
42
44
  # Streams AddressConfigurationInstance records from the API as an Enumerable.
43
45
  # This operation lazily loads records as efficiently as possible until the limit
44
46
  # is reached.
47
+ # @param [String] type Filter the address configurations by its type. This value
48
+ # can be one of: `whatsapp`, `sms`.
45
49
  # @param [Integer] limit Upper limit for the number of records to return. stream()
46
50
  # guarantees to never return more than limit. Default is no limit.
47
51
  # @param [Integer] page_size Number of records to fetch per request, when
@@ -49,10 +53,10 @@ module Twilio
49
53
  # but a limit is defined, stream() will attempt to read the limit with the most
50
54
  # efficient page size, i.e. min(limit, 1000)
51
55
  # @return [Enumerable] Enumerable that will yield up to limit results
52
- def stream(limit: nil, page_size: nil)
56
+ def stream(type: :unset, limit: nil, page_size: nil)
53
57
  limits = @version.read_limits(limit, page_size)
54
58
 
55
- page = self.page(page_size: limits[:page_size], )
59
+ page = self.page(type: type, page_size: limits[:page_size], )
56
60
 
57
61
  @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])
58
62
  end
@@ -74,12 +78,15 @@ module Twilio
74
78
  ##
75
79
  # Retrieve a single page of AddressConfigurationInstance records from the API.
76
80
  # Request is executed immediately.
81
+ # @param [String] type Filter the address configurations by its type. This value
82
+ # can be one of: `whatsapp`, `sms`.
77
83
  # @param [String] page_token PageToken provided by the API
78
84
  # @param [Integer] page_number Page Number, this value is simply for client state
79
85
  # @param [Integer] page_size Number of records to return, defaults to 50
80
86
  # @return [Page] Page of AddressConfigurationInstance
81
- def page(page_token: :unset, page_number: :unset, page_size: :unset)
87
+ def page(type: :unset, page_token: :unset, page_number: :unset, page_size: :unset)
82
88
  params = Twilio::Values.of({
89
+ 'Type' => type,
83
90
  'PageToken' => page_token,
84
91
  'Page' => page_number,
85
92
  'PageSize' => page_size,
@@ -27,19 +27,19 @@ module Twilio
27
27
 
28
28
  ##
29
29
  # Create the EsimProfileInstance
30
- # @param [String] eid Identifier of the eUICC that will claim the eSIM Profile.
31
30
  # @param [String] callback_url The URL we should call using the `callback_method`
32
31
  # when the status of the eSIM Profile changes. At this stage of the eSIM Profile
33
32
  # pilot, the a request to the URL will only be called when the ESimProfile
34
33
  # resource changes from `reserving` to `available`.
35
34
  # @param [String] callback_method The HTTP method we should use to call
36
35
  # `callback_url`. Can be: `GET` or `POST` and the default is POST.
36
+ # @param [String] eid Identifier of the eUICC that will claim the eSIM Profile.
37
37
  # @return [EsimProfileInstance] Created EsimProfileInstance
38
- def create(eid: nil, callback_url: :unset, callback_method: :unset)
38
+ def create(callback_url: :unset, callback_method: :unset, eid: :unset)
39
39
  data = Twilio::Values.of({
40
- 'Eid' => eid,
41
40
  'CallbackUrl' => callback_url,
42
41
  'CallbackMethod' => callback_method,
42
+ 'Eid' => eid,
43
43
  })
44
44
 
45
45
  payload = @version.create('POST', @uri, data: data)
@@ -263,6 +263,8 @@ module Twilio
263
263
  'data_upload' => payload['data_upload'].to_i,
264
264
  'data_download' => payload['data_download'].to_i,
265
265
  'data_total' => payload['data_total'].to_i,
266
+ 'data_total_billed' => payload['data_total_billed'].to_f,
267
+ 'billed_unit' => payload['billed_unit'],
266
268
  }
267
269
  end
268
270
 
@@ -320,6 +322,18 @@ module Twilio
320
322
  @properties['data_total']
321
323
  end
322
324
 
325
+ ##
326
+ # @return [String] Total amount in the `billed_unit` that was charged for the data uploaded or downloaded.
327
+ def data_total_billed
328
+ @properties['data_total_billed']
329
+ end
330
+
331
+ ##
332
+ # @return [String] The currency in which the billed amounts are measured, specified in the 3 letter ISO 4127 format (e.g. `USD`, `EUR`, `JPY`).
333
+ def billed_unit
334
+ @properties['billed_unit']
335
+ end
336
+
323
337
  ##
324
338
  # Provide a user friendly representation
325
339
  def to_s
@@ -48,10 +48,12 @@ module Twilio
48
48
  # a custom code instead of a randomly generated one. Not available for all
49
49
  # customers.
50
50
  # @param [Boolean] push_include_date Optional configuration for the Push factors.
51
- # If true, include the date in the Challenge's reponse. Otherwise, the date is
51
+ # If true, include the date in the Challenge's response. Otherwise, the date is
52
52
  # omitted from the response. See
53
53
  # {Challenge}[https://www.twilio.com/docs/verify/api/challenge] resource’s details
54
- # parameter for more info. Default: true
54
+ # parameter for more info. Default: false. **Deprecated** do not use this
55
+ # parameter. This timestamp value is the same one as the one found in
56
+ # `date_created`, please use that one instead.
55
57
  # @param [String] push_apn_credential_sid Optional configuration for the Push
56
58
  # factors. Set the APN Credential for this service. This will allow to send push
57
59
  # notifications to iOS devices. See {Credential
@@ -282,10 +284,11 @@ module Twilio
282
284
  # a custom code instead of a randomly generated one. Not available for all
283
285
  # customers.
284
286
  # @param [Boolean] push_include_date Optional configuration for the Push factors.
285
- # If true, include the date in the Challenge's reponse. Otherwise, the date is
287
+ # If true, include the date in the Challenge's response. Otherwise, the date is
286
288
  # omitted from the response. See
287
289
  # {Challenge}[https://www.twilio.com/docs/verify/api/challenge] resource’s details
288
- # parameter for more info. Default: true
290
+ # parameter for more info. Default: false. **Deprecated** do not use this
291
+ # parameter.
289
292
  # @param [String] push_apn_credential_sid Optional configuration for the Push
290
293
  # factors. Set the APN Credential for this service. This will allow to send push
291
294
  # notifications to iOS devices. See {Credential
@@ -666,10 +669,11 @@ module Twilio
666
669
  # a custom code instead of a randomly generated one. Not available for all
667
670
  # customers.
668
671
  # @param [Boolean] push_include_date Optional configuration for the Push factors.
669
- # If true, include the date in the Challenge's reponse. Otherwise, the date is
672
+ # If true, include the date in the Challenge's response. Otherwise, the date is
670
673
  # omitted from the response. See
671
674
  # {Challenge}[https://www.twilio.com/docs/verify/api/challenge] resource’s details
672
- # parameter for more info. Default: true
675
+ # parameter for more info. Default: false. **Deprecated** do not use this
676
+ # parameter.
673
677
  # @param [String] push_apn_credential_sid Optional configuration for the Push
674
678
  # factors. Set the APN Credential for this service. This will allow to send push
675
679
  # notifications to iOS devices. See {Credential
@@ -72,8 +72,10 @@ module Twilio
72
72
  # @param [String] unused_room_timeout Configures how long (in minutes) a room will
73
73
  # remain active if no one joins. Valid values range from 1 to 60 minutes (no
74
74
  # fractions).
75
+ # @param [Boolean] large_room When set to true, indicated that this is the large
76
+ # room.
75
77
  # @return [RoomInstance] Created RoomInstance
76
- def create(enable_turn: :unset, type: :unset, unique_name: :unset, status_callback: :unset, status_callback_method: :unset, max_participants: :unset, record_participants_on_connect: :unset, video_codecs: :unset, media_region: :unset, recording_rules: :unset, audio_only: :unset, max_participant_duration: :unset, empty_room_timeout: :unset, unused_room_timeout: :unset)
78
+ def create(enable_turn: :unset, type: :unset, unique_name: :unset, status_callback: :unset, status_callback_method: :unset, max_participants: :unset, record_participants_on_connect: :unset, video_codecs: :unset, media_region: :unset, recording_rules: :unset, audio_only: :unset, max_participant_duration: :unset, empty_room_timeout: :unset, unused_room_timeout: :unset, large_room: :unset)
77
79
  data = Twilio::Values.of({
78
80
  'EnableTurn' => enable_turn,
79
81
  'Type' => type,
@@ -89,6 +91,7 @@ module Twilio
89
91
  'MaxParticipantDuration' => max_participant_duration,
90
92
  'EmptyRoomTimeout' => empty_room_timeout,
91
93
  'UnusedRoomTimeout' => unused_room_timeout,
94
+ 'LargeRoom' => large_room,
92
95
  })
93
96
 
94
97
  payload = @version.create('POST', @uri, data: data)
@@ -387,6 +390,7 @@ module Twilio
387
390
  'audio_only' => payload['audio_only'],
388
391
  'empty_room_timeout' => payload['empty_room_timeout'].to_i,
389
392
  'unused_room_timeout' => payload['unused_room_timeout'].to_i,
393
+ 'large_room' => payload['large_room'],
390
394
  'url' => payload['url'],
391
395
  'links' => payload['links'],
392
396
  }
@@ -533,6 +537,12 @@ module Twilio
533
537
  @properties['unused_room_timeout']
534
538
  end
535
539
 
540
+ ##
541
+ # @return [Boolean] Indicates if this is a large room.
542
+ def large_room
543
+ @properties['large_room']
544
+ end
545
+
536
546
  ##
537
547
  # @return [String] The absolute URL of the resource
538
548
  def url
@@ -1,3 +1,3 @@
1
1
  module Twilio
2
- VERSION = '5.66.2'
2
+ VERSION = '5.67.0'
3
3
  end
data/lib/twilio-ruby.rb CHANGED
@@ -10,7 +10,7 @@ require 'time'
10
10
  require 'json'
11
11
 
12
12
  require 'twilio-ruby/version' unless defined?(Twilio::VERSION)
13
- require 'rack/twilio_webhook_authentication' if defined?(Rack)
13
+ require 'rack/twilio_webhook_authentication' if defined?(Rack) && defined?(Rack::MediaType)
14
14
 
15
15
  require 'twilio-ruby/util'
16
16
  require 'twilio-ruby/security/request_validator'
data/twilio-ruby.gemspec CHANGED
@@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
26
26
 
27
27
  spec.add_dependency('jwt', '>= 1.5', '<= 2.5')
28
28
  spec.add_dependency('nokogiri', '>= 1.6', '< 2.0')
29
- spec.add_dependency('faraday', '>= 0.9', '< 2.0')
29
+ spec.add_dependency('faraday', '>= 0.9', '< 3.0')
30
30
  # Workaround for RBX <= 2.2.1, should be fixed in next version
31
31
  spec.add_dependency('rubysl') if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'rbx'
32
32
 
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.66.2
4
+ version: 5.67.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-04-20 00:00:00.000000000 Z
11
+ date: 2022-05-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jwt
@@ -59,7 +59,7 @@ dependencies:
59
59
  version: '0.9'
60
60
  - - "<"
61
61
  - !ruby/object:Gem::Version
62
- version: '2.0'
62
+ version: '3.0'
63
63
  type: :runtime
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
@@ -69,7 +69,7 @@ dependencies:
69
69
  version: '0.9'
70
70
  - - "<"
71
71
  - !ruby/object:Gem::Version
72
- version: '2.0'
72
+ version: '3.0'
73
73
  - !ruby/object:Gem::Dependency
74
74
  name: bundler
75
75
  requirement: !ruby/object:Gem::Requirement