twilio-ruby 5.33.1 → 5.34.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
  SHA256:
3
- metadata.gz: bc2375a785a81e777ac954cf9e7a4f01253074c3b68ce2d2dd0e78490ed18dd3
4
- data.tar.gz: b9886861ae41d1122f6ae717d38f8f2d55d4576f474f8027a1c280f1557dc385
3
+ metadata.gz: a3c2f4bbf217f506df9191e83264ccfc2966a7500754885341f4c0bd7626a35a
4
+ data.tar.gz: 2f770e917a2b26214707107eaa47ad3052a8ef883ba1293caf47b89a87be9fef
5
5
  SHA512:
6
- metadata.gz: 64fffab9445d38a5ed7e5480e9ef87c3154ecfd4016d28316cb56532e6cf87ba0654917ddfa59297dba68dc98f97b0a7ea63633d60eaac2556364f58d72a245a
7
- data.tar.gz: 15fa8917d0fc09a101cdb184b8e6e365c140d213ea4df25bd62e0f0b922bda74177ce5e3a3300c9c71095d18668bbbc1318ef095a973c23aca2be33d2babf245
6
+ metadata.gz: 236c258000ffa8eacdb7947f3b7268fdfe5c141e0e3de6cd6ba90b2a8591a21c5dbd0fa88da678a6fbd3744aead2fcb951e92de8be9c3fc9ff7d035c132e7342
7
+ data.tar.gz: f60524d0983d267aefcf3d01234bcbf39b4de400e08bfd650edbc6a0c29c0dd67f46db2985d87325d28d51649376e8df27db1f38d00c6fd24b12e1517d7b1369
@@ -15,6 +15,14 @@ Layout/LineLength:
15
15
  Exclude:
16
16
  - 'spec/**/*'
17
17
 
18
+ Style/BlockDelimiters:
19
+ Exclude:
20
+ - 'spec/**/*'
21
+
22
+ Lint/AmbiguousBlockAssociation:
23
+ Exclude:
24
+ - 'spec/**/*'
25
+
18
26
  Metrics/BlockLength:
19
27
  Exclude:
20
28
  - 'spec/**/*'
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2020-01-06 13:56:04 -0300 using RuboCop version 0.79.0.
3
+ # on 2020-04-29 14:57:47 -0500 using RuboCop version 0.82.0.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
@@ -55,22 +55,14 @@ Layout/SpaceInsideHashLiteralBraces:
55
55
 
56
56
  # Offense count: 1
57
57
  # Cop supports --auto-correct.
58
- # Configuration parameters: IndentationWidth.
59
- Layout/Tab:
60
- Exclude:
61
- - 'twilio-ruby.gemspec'
62
-
63
- # Offense count: 2
64
- # Cop supports --auto-correct.
65
58
  # Configuration parameters: IgnoreEmptyBlocks, AllowUnusedKeywordArguments.
66
59
  Lint/UnusedBlockArgument:
67
60
  Exclude:
68
- - 'Rakefile'
69
61
  - 'spec/rack/twilio_webhook_authentication_spec.rb'
70
62
 
71
63
  # Offense count: 4
72
64
  # Cop supports --auto-correct.
73
- # Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods.
65
+ # Configuration parameters: AllowUnusedKeywordArguments, IgnoreEmptyMethods, IgnoreNotImplementedMethods.
74
66
  Lint/UnusedMethodArgument:
75
67
  Exclude:
76
68
  - 'lib/twilio-ruby.rb'
@@ -88,12 +80,6 @@ Lint/UselessAssignment:
88
80
  Exclude:
89
81
  - 'spec/rack/twilio_webhook_authentication_spec.rb'
90
82
 
91
- # Offense count: 1
92
- # Configuration parameters: CountComments, ExcludedMethods.
93
- # ExcludedMethods: refine
94
- Metrics/BlockLength:
95
- Max: 28
96
-
97
83
  # Offense count: 1
98
84
  # Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts, AllowedAcronyms.
99
85
  # AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
@@ -103,7 +89,7 @@ Naming/FileName:
103
89
 
104
90
  # Offense count: 2
105
91
  # Configuration parameters: MinNameLength, AllowNamesEndingInNumbers, AllowedNames, ForbiddenNames.
106
- # AllowedNames: io, id, to, by, on, in, at, ip, db, os
92
+ # AllowedNames: io, id, to, by, on, in, at, ip, db, os, pp
107
93
  Naming/MethodParameterName:
108
94
  Exclude:
109
95
  - 'lib/twilio-ruby/security/request_validator.rb'
@@ -116,7 +102,7 @@ Naming/VariableName:
116
102
  - 'spec/jwt/client_capability_spec.rb'
117
103
  - 'spec/jwt/task_router_spec.rb'
118
104
 
119
- # Offense count: 38
105
+ # Offense count: 39
120
106
  Style/Documentation:
121
107
  Enabled: false
122
108
 
@@ -136,7 +122,7 @@ Style/ExpandPathArguments:
136
122
  # Offense count: 23
137
123
  # Cop supports --auto-correct.
138
124
  # Configuration parameters: EnforcedStyle.
139
- # SupportedStyles: always, never
125
+ # SupportedStyles: always, always_true, never
140
126
  Style/FrozenStringLiteralComment:
141
127
  Enabled: false
142
128
 
@@ -195,13 +181,6 @@ Style/StringLiterals:
195
181
  Exclude:
196
182
  - 'spec/framework/serialize_spec.rb'
197
183
 
198
- # Offense count: 1
199
- # Cop supports --auto-correct.
200
- # Configuration parameters: MinSize.
201
- # SupportedStyles: percent, brackets
202
- Style/SymbolArray:
203
- EnforcedStyle: brackets
204
-
205
184
  # Offense count: 14
206
185
  # Cop supports --auto-correct.
207
186
  # Configuration parameters: AllowNamedUnderscoreVariables.
data/CHANGES.md CHANGED
@@ -1,6 +1,21 @@
1
1
  twilio-ruby changelog
2
2
  =====================
3
3
 
4
+ [2020-04-29] Version 5.34.0
5
+ ---------------------------
6
+ **Library - Feature**
7
+ - [PR #511](https://github.com/twilio/twilio-ruby/pull/511): add details to error object. Thanks to [@ashish-s](https://github.com/ashish-s)!
8
+
9
+ **Preview**
10
+ - Added `Dispatch` version to `preview`
11
+
12
+ **Studio**
13
+ - Reroute Create Execution for V2 to the V2 downstream
14
+
15
+ **Supersim**
16
+ - Add Networks resource
17
+
18
+
4
19
  [2020-04-15] Version 5.33.1
5
20
  ---------------------------
6
21
  **Library - Fix**
data/README.md CHANGED
@@ -32,13 +32,13 @@ This library supports the following Ruby implementations:
32
32
  To install using [Bundler][bundler] grab the latest stable version:
33
33
 
34
34
  ```ruby
35
- gem 'twilio-ruby', '~> 5.33.1'
35
+ gem 'twilio-ruby', '~> 5.34.0'
36
36
  ```
37
37
 
38
38
  To manually install `twilio-ruby` via [Rubygems][rubygems] simply gem install:
39
39
 
40
40
  ```bash
41
- gem install twilio-ruby -v 5.33.1
41
+ gem install twilio-ruby -v 5.34.0
42
42
  ```
43
43
 
44
44
  To build and install the development branch yourself from the latest source:
@@ -11,12 +11,12 @@ module Twilio
11
11
  end
12
12
 
13
13
  class RestError < TwilioError
14
- attr_reader :message, :response, :code, :status_code, :detail, :more_info, :error_message
14
+ attr_reader :message, :response, :code, :status_code, :details, :more_info, :error_message
15
15
 
16
16
  def initialize(message, response)
17
17
  @status_code = response.status_code
18
18
  @code = response.body.fetch('code', @status_code)
19
- @detail = response.body.fetch('detail', nil)
19
+ @details = response.body.fetch('details', nil)
20
20
  @error_message = response.body.fetch('message', nil)
21
21
  @more_info = response.body.fetch('more_info', nil)
22
22
  @message = format_message(message)
@@ -39,7 +39,7 @@ module Twilio
39
39
  def format_message(initial_message)
40
40
  message = "[HTTP #{status_code}] #{code} : #{initial_message}"
41
41
  message += "\n#{error_message}" if error_message
42
- message += "\n#{detail}" if detail
42
+ message += "\n#{details}" if details
43
43
  message += "\n#{more_info}" if more_info
44
44
  message + "\n\n"
45
45
  end
@@ -63,6 +63,8 @@ module Twilio
63
63
  # action and you intend to confirm delivery of the message using the [Message
64
64
  # Feedback API](https://www.twilio.com/docs/sms/api/message-feedback-resource).
65
65
  # This parameter is `false` by default.
66
+ # @param [String] attempt Total number of attempts made ( including this ) to send
67
+ # out the message regardless of the provider used
66
68
  # @param [String] validity_period How long in seconds the message can remain in
67
69
  # our outgoing message queue. After this period elapses, the message fails and we
68
70
  # call your status callback. Can be between 1 and the default value of 14,400
@@ -100,7 +102,7 @@ module Twilio
100
102
  # parameters in the POST request. You can include up to 10 `media_url` parameters
101
103
  # per message. You can send images in an SMS message in only the US and Canada.
102
104
  # @return [MessageInstance] Newly created MessageInstance
103
- def create(to: nil, status_callback: :unset, application_sid: :unset, max_price: :unset, provide_feedback: :unset, validity_period: :unset, force_delivery: :unset, content_retention: :unset, address_retention: :unset, smart_encoded: :unset, persistent_action: :unset, from: :unset, messaging_service_sid: :unset, body: :unset, media_url: :unset)
105
+ def create(to: nil, status_callback: :unset, application_sid: :unset, max_price: :unset, provide_feedback: :unset, attempt: :unset, validity_period: :unset, force_delivery: :unset, content_retention: :unset, address_retention: :unset, smart_encoded: :unset, persistent_action: :unset, from: :unset, messaging_service_sid: :unset, body: :unset, media_url: :unset)
104
106
  data = Twilio::Values.of({
105
107
  'To' => to,
106
108
  'From' => from,
@@ -111,6 +113,7 @@ module Twilio
111
113
  'ApplicationSid' => application_sid,
112
114
  'MaxPrice' => max_price,
113
115
  'ProvideFeedback' => provide_feedback,
116
+ 'Attempt' => attempt,
114
117
  'ValidityPeriod' => validity_period,
115
118
  'ForceDelivery' => force_delivery,
116
119
  'ContentRetention' => content_retention,
@@ -39,14 +39,17 @@ module Twilio
39
39
  # store any data you wish. The string value must contain structurally valid JSON
40
40
  # if specified. **Note** that if the attributes are not set "{}" will be
41
41
  # returned.
42
+ # @param [conversation.State] state Current state of this conversation. Can be
43
+ # either `active`, `inactive` or `closed` and defaults to `active`
42
44
  # @return [ConversationInstance] Newly created ConversationInstance
43
- def create(friendly_name: :unset, date_created: :unset, date_updated: :unset, messaging_service_sid: :unset, attributes: :unset)
45
+ def create(friendly_name: :unset, date_created: :unset, date_updated: :unset, messaging_service_sid: :unset, attributes: :unset, state: :unset)
44
46
  data = Twilio::Values.of({
45
47
  'FriendlyName' => friendly_name,
46
48
  'DateCreated' => Twilio.serialize_iso8601_datetime(date_created),
47
49
  'DateUpdated' => Twilio.serialize_iso8601_datetime(date_updated),
48
50
  'MessagingServiceSid' => messaging_service_sid,
49
51
  'Attributes' => attributes,
52
+ 'State' => state,
50
53
  })
51
54
 
52
55
  payload = @version.create(
@@ -213,14 +216,17 @@ module Twilio
213
216
  # @param [String] messaging_service_sid The unique id of the [SMS
214
217
  # Service](https://www.twilio.com/docs/sms/services/api) this conversation belongs
215
218
  # to.
219
+ # @param [conversation.State] state Current state of this conversation. Can be
220
+ # either `active`, `inactive` or `closed` and defaults to `active`
216
221
  # @return [ConversationInstance] Updated ConversationInstance
217
- def update(friendly_name: :unset, date_created: :unset, date_updated: :unset, attributes: :unset, messaging_service_sid: :unset)
222
+ def update(friendly_name: :unset, date_created: :unset, date_updated: :unset, attributes: :unset, messaging_service_sid: :unset, state: :unset)
218
223
  data = Twilio::Values.of({
219
224
  'FriendlyName' => friendly_name,
220
225
  'DateCreated' => Twilio.serialize_iso8601_datetime(date_created),
221
226
  'DateUpdated' => Twilio.serialize_iso8601_datetime(date_updated),
222
227
  'Attributes' => attributes,
223
228
  'MessagingServiceSid' => messaging_service_sid,
229
+ 'State' => state,
224
230
  })
225
231
 
226
232
  payload = @version.update(
@@ -344,6 +350,7 @@ module Twilio
344
350
  'sid' => payload['sid'],
345
351
  'friendly_name' => payload['friendly_name'],
346
352
  'attributes' => payload['attributes'],
353
+ 'state' => payload['state'],
347
354
  'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
348
355
  'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
349
356
  'url' => payload['url'],
@@ -402,6 +409,12 @@ module Twilio
402
409
  @properties['attributes']
403
410
  end
404
411
 
412
+ ##
413
+ # @return [conversation.State] Current state of this conversation.
414
+ def state
415
+ @properties['state']
416
+ end
417
+
405
418
  ##
406
419
  # @return [Time] The date that this resource was created.
407
420
  def date_created
@@ -439,14 +452,17 @@ module Twilio
439
452
  # @param [String] messaging_service_sid The unique id of the [SMS
440
453
  # Service](https://www.twilio.com/docs/sms/services/api) this conversation belongs
441
454
  # to.
455
+ # @param [conversation.State] state Current state of this conversation. Can be
456
+ # either `active`, `inactive` or `closed` and defaults to `active`
442
457
  # @return [ConversationInstance] Updated ConversationInstance
443
- def update(friendly_name: :unset, date_created: :unset, date_updated: :unset, attributes: :unset, messaging_service_sid: :unset)
458
+ def update(friendly_name: :unset, date_created: :unset, date_updated: :unset, attributes: :unset, messaging_service_sid: :unset, state: :unset)
444
459
  context.update(
445
460
  friendly_name: friendly_name,
446
461
  date_created: date_created,
447
462
  date_updated: date_updated,
448
463
  attributes: attributes,
449
464
  messaging_service_sid: messaging_service_sid,
465
+ state: state,
450
466
  )
451
467
  end
452
468
 
@@ -143,9 +143,11 @@ module Twilio
143
143
  # task is created with the channel. **Note** that does not apply when channel type
144
144
  # is `web`. Setting the value to `true` for channel type `web` will result in
145
145
  # misconfigured Flex Flow and no tasks will be created.
146
- # @param [Boolean] long_lived Whether new channels are long-lived.
147
- # @param [Boolean] janitor_enabled Boolean flag for enabling or disabling the
148
- # Janitor.
146
+ # @param [Boolean] long_lived When enabled, Flex will keep the chat channel active
147
+ # so that it may be used for subsequent interactions with a contact identity.
148
+ # @param [Boolean] janitor_enabled When enabled, the Messaging Channel Janitor
149
+ # will remove active Proxy sessions if the associated Task is deleted outside of
150
+ # the Flex UI.
149
151
  # @param [String] integration_retry_count The number of times to retry the webhook
150
152
  # if the first attempt fails. Can be an integer between 0 and 3, inclusive, and
151
153
  # the default is 0.
@@ -275,9 +277,11 @@ module Twilio
275
277
  # task is created with the channel. **Note** that does not apply when channel type
276
278
  # is `web`. Setting the value to `true` for channel type `web` will result in
277
279
  # misconfigured Flex Flow and no tasks will be created.
278
- # @param [Boolean] long_lived Whether new channels created are long-lived.
279
- # @param [Boolean] janitor_enabled Boolean flag for enabling or disabling the
280
- # Janitor.
280
+ # @param [Boolean] long_lived When enabled, Flex will keep the chat channel active
281
+ # so that it may be used for subsequent interactions with a contact identity.
282
+ # @param [Boolean] janitor_enabled When enabled, the Messaging Channel Janitor
283
+ # will remove active Proxy sessions if the associated Task is deleted outside of
284
+ # the Flex UI.
281
285
  # @param [String] integration_retry_count The number of times to retry the webhook
282
286
  # if the first attempt fails. Can be an integer between 0 and 3, inclusive, and
283
287
  # the default is 0.
@@ -445,13 +449,13 @@ module Twilio
445
449
  end
446
450
 
447
451
  ##
448
- # @return [Boolean] Whether new channels are long-lived
452
+ # @return [Boolean] Re-use this chat channel for future interactions with a contact
449
453
  def long_lived
450
454
  @properties['long_lived']
451
455
  end
452
456
 
453
457
  ##
454
- # @return [Boolean] Boolean flag for enabling or disabling the Janitor
458
+ # @return [Boolean] Remove active Proxy sessions if the corresponding Task is deleted.
455
459
  def janitor_enabled
456
460
  @properties['janitor_enabled']
457
461
  end
@@ -499,9 +503,11 @@ module Twilio
499
503
  # task is created with the channel. **Note** that does not apply when channel type
500
504
  # is `web`. Setting the value to `true` for channel type `web` will result in
501
505
  # misconfigured Flex Flow and no tasks will be created.
502
- # @param [Boolean] long_lived Whether new channels created are long-lived.
503
- # @param [Boolean] janitor_enabled Boolean flag for enabling or disabling the
504
- # Janitor.
506
+ # @param [Boolean] long_lived When enabled, Flex will keep the chat channel active
507
+ # so that it may be used for subsequent interactions with a contact identity.
508
+ # @param [Boolean] janitor_enabled When enabled, the Messaging Channel Janitor
509
+ # will remove active Proxy sessions if the associated Task is deleted outside of
510
+ # the Flex UI.
505
511
  # @param [String] integration_retry_count The number of times to retry the webhook
506
512
  # if the first attempt fails. Can be an integer between 0 and 3, inclusive, and
507
513
  # the default is 0.
@@ -10,8 +10,6 @@ module Twilio
10
10
  module REST
11
11
  class Video < Domain
12
12
  class V1 < Version
13
- ##
14
- # 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.
15
13
  class CompositionSettingsList < ListResource
16
14
  ##
17
15
  # Initialize the CompositionSettingsList
@@ -31,8 +29,6 @@ module Twilio
31
29
  end
32
30
  end
33
31
 
34
- ##
35
- # 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.
36
32
  class CompositionSettingsPage < Page
37
33
  ##
38
34
  # Initialize the CompositionSettingsPage
@@ -62,8 +58,6 @@ module Twilio
62
58
  end
63
59
  end
64
60
 
65
- ##
66
- # 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.
67
61
  class CompositionSettingsContext < InstanceContext
68
62
  ##
69
63
  # Initialize the CompositionSettingsContext
@@ -143,8 +137,6 @@ module Twilio
143
137
  end
144
138
  end
145
139
 
146
- ##
147
- # 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.
148
140
  class CompositionSettingsInstance < InstanceResource
149
141
  ##
150
142
  # Initialize the CompositionSettingsInstance
@@ -10,8 +10,6 @@ module Twilio
10
10
  module REST
11
11
  class Video < Domain
12
12
  class V1 < Version
13
- ##
14
- # 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.
15
13
  class RecordingSettingsList < ListResource
16
14
  ##
17
15
  # Initialize the RecordingSettingsList
@@ -31,8 +29,6 @@ module Twilio
31
29
  end
32
30
  end
33
31
 
34
- ##
35
- # 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.
36
32
  class RecordingSettingsPage < Page
37
33
  ##
38
34
  # Initialize the RecordingSettingsPage
@@ -62,8 +58,6 @@ module Twilio
62
58
  end
63
59
  end
64
60
 
65
- ##
66
- # 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.
67
61
  class RecordingSettingsContext < InstanceContext
68
62
  ##
69
63
  # Initialize the RecordingSettingsContext
@@ -143,8 +137,6 @@ module Twilio
143
137
  end
144
138
  end
145
139
 
146
- ##
147
- # 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.
148
140
  class RecordingSettingsInstance < InstanceResource
149
141
  ##
150
142
  # Initialize the RecordingSettingsInstance
@@ -1,3 +1,3 @@
1
1
  module Twilio
2
- VERSION = '5.33.1'
2
+ VERSION = '5.34.0'
3
3
  end
@@ -37,6 +37,7 @@ describe 'Conversation' do
37
37
  "attributes": "{ \\"topic\\": \\"feedback\\" }",
38
38
  "date_created": "2015-12-16T22:18:37Z",
39
39
  "date_updated": "2015-12-16T22:18:38Z",
40
+ "state": "inactive",
40
41
  "url": "https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
41
42
  "links": {
42
43
  "participants": "https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants",
@@ -80,6 +81,7 @@ describe 'Conversation' do
80
81
  "attributes": "{ \\"topic\\": \\"feedback\\" }",
81
82
  "date_created": "2015-12-16T22:18:37Z",
82
83
  "date_updated": "2015-12-16T22:18:38Z",
84
+ "state": "inactive",
83
85
  "url": "https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
84
86
  "links": {
85
87
  "participants": "https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants",
@@ -149,6 +151,7 @@ describe 'Conversation' do
149
151
  "attributes": "{ \\"topic\\": \\"feedback\\" }",
150
152
  "date_created": "2015-12-16T22:18:37Z",
151
153
  "date_updated": "2015-12-16T22:18:38Z",
154
+ "state": "active",
152
155
  "url": "https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
153
156
  "links": {
154
157
  "participants": "https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants",
@@ -194,6 +197,7 @@ describe 'Conversation' do
194
197
  "attributes": "{ \\"topic\\": \\"feedback\\" }",
195
198
  "date_created": "2015-12-16T22:18:37Z",
196
199
  "date_updated": "2015-12-16T22:18:38Z",
200
+ "state": "active",
197
201
  "url": "https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
198
202
  "links": {
199
203
  "participants": "https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants",
@@ -78,7 +78,7 @@ describe 'AssetVersion' do
78
78
  "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
79
79
  "service_sid": "ZS00000000000000000000000000000000",
80
80
  "asset_sid": "ZH00000000000000000000000000000000",
81
- "path": "test-path",
81
+ "path": "/test-path",
82
82
  "visibility": "public",
83
83
  "date_created": "2018-11-10T20:00:00Z",
84
84
  "url": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Assets/ZH00000000000000000000000000000000/Versions/ZN00000000000000000000000000000000"
@@ -81,7 +81,7 @@ describe 'Build' do
81
81
  "service_sid": "ZS00000000000000000000000000000000",
82
82
  "asset_sid": "ZH00000000000000000000000000000000",
83
83
  "date_created": "2018-11-10T20:00:00Z",
84
- "path": "asset-path",
84
+ "path": "/asset-path",
85
85
  "visibility": "PUBLIC"
86
86
  }
87
87
  ],
@@ -92,7 +92,7 @@ describe 'Build' do
92
92
  "service_sid": "ZS00000000000000000000000000000000",
93
93
  "function_sid": "ZH00000000000000000000000000000001",
94
94
  "date_created": "2018-11-10T20:00:00Z",
95
- "path": "function-path",
95
+ "path": "/function-path",
96
96
  "visibility": "PUBLIC"
97
97
  }
98
98
  ],
@@ -175,7 +175,7 @@ describe 'Build' do
175
175
  "service_sid": "ZS00000000000000000000000000000000",
176
176
  "asset_sid": "ZH00000000000000000000000000000000",
177
177
  "date_created": "2018-11-10T20:00:00Z",
178
- "path": "asset-path",
178
+ "path": "/asset-path",
179
179
  "visibility": "PUBLIC"
180
180
  }
181
181
  ],
@@ -186,7 +186,7 @@ describe 'Build' do
186
186
  "service_sid": "ZS00000000000000000000000000000000",
187
187
  "function_sid": "ZH00000000000000000000000000000001",
188
188
  "date_created": "2018-11-10T20:00:00Z",
189
- "path": "function-path",
189
+ "path": "/function-path",
190
190
  "visibility": "PUBLIC"
191
191
  }
192
192
  ],
@@ -78,7 +78,7 @@ describe 'FunctionVersion' do
78
78
  "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
79
79
  "service_sid": "ZS00000000000000000000000000000000",
80
80
  "function_sid": "ZH00000000000000000000000000000000",
81
- "path": "test-path",
81
+ "path": "/test-path",
82
82
  "visibility": "public",
83
83
  "date_created": "2018-11-10T20:00:00Z",
84
84
  "url": "https://serverless.twilio.com/v1/Services/ZS00000000000000000000000000000000/Functions/ZH00000000000000000000000000000000/Versions/ZN00000000000000000000000000000000",
@@ -80,4 +80,44 @@ describe Twilio::REST::Client do
80
80
  @holodeck.mock Twilio::Response.new(504, '')
81
81
  expect { @client.validate_ssl_certificate }.to raise_error(Twilio::REST::RestError)
82
82
  end
83
+
84
+ it 'translates bad request error params' do
85
+ @domain = MyDomain.new(@client)
86
+ @version = MyVersion.new(@domain)
87
+ @error_message = '{
88
+ "code": 20001,
89
+ "message": "Bad request",
90
+ "more_info": "https://www.twilio.com/docs/errors/20001",
91
+ "status": 400,
92
+ "details": {
93
+ "foo":"bar"
94
+ }}'
95
+ @holodeck.mock Twilio::Response.new(400, @error_message)
96
+ expect {
97
+ @version.fetch('GET', 'http://foobar.com')
98
+ }.to raise_error { |error|
99
+ expect(error).to be_a(Twilio::REST::RestError)
100
+ expect(error.status_code).to eq(400)
101
+ expect(error.code).to eq(20_001)
102
+ expect(error.details).to eq({ 'foo' => 'bar' })
103
+ expect(error.error_message).to eq('Bad request')
104
+ expect(error.more_info).to eq('https://www.twilio.com/docs/errors/20001')
105
+ }
106
+ end
107
+
108
+ class MyVersion < Twilio::REST::Version
109
+ def initialize(domain)
110
+ super
111
+ @version = 'v1'
112
+ end
113
+ end
114
+
115
+ class MyDomain < Twilio::REST::Domain
116
+ def initialize(client)
117
+ super
118
+ @host = 'twilio.com'
119
+ @base_url = 'https://twilio.com'
120
+ @port = 443
121
+ end
122
+ end
83
123
  end
@@ -36,6 +36,6 @@ Gem::Specification.new do |spec|
36
36
  spec.add_development_dependency 'rack', '~> 2.0'
37
37
  spec.add_development_dependency 'rake', '~> 13.0'
38
38
  spec.add_development_dependency 'rspec', '~> 3.0'
39
- spec.add_development_dependency 'rubocop', '~> 0.80.0'
39
+ spec.add_development_dependency 'rubocop', '~> 0.82.0'
40
40
  spec.add_development_dependency 'yard', '~> 0.9.9'
41
41
  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.33.1
4
+ version: 5.34.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: 2020-04-15 00:00:00.000000000 Z
11
+ date: 2020-04-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jwt
@@ -166,14 +166,14 @@ dependencies:
166
166
  requirements:
167
167
  - - "~>"
168
168
  - !ruby/object:Gem::Version
169
- version: 0.80.0
169
+ version: 0.82.0
170
170
  type: :development
171
171
  prerelease: false
172
172
  version_requirements: !ruby/object:Gem::Requirement
173
173
  requirements:
174
174
  - - "~>"
175
175
  - !ruby/object:Gem::Version
176
- version: 0.80.0
176
+ version: 0.82.0
177
177
  - !ruby/object:Gem::Dependency
178
178
  name: yard
179
179
  requirement: !ruby/object:Gem::Requirement