twilio-ruby 5.10.3 → 5.10.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +14 -0
  3. data/README.md +2 -2
  4. data/lib/twilio-ruby/rest/api.rb +1 -1
  5. data/lib/twilio-ruby/rest/api/v2010/account/call.rb +109 -107
  6. data/lib/twilio-ruby/rest/api/v2010/account/call/feedback.rb +2 -2
  7. data/lib/twilio-ruby/rest/api/v2010/account/call/feedback_summary.rb +2 -2
  8. data/lib/twilio-ruby/rest/api/v2010/account/conference.rb +8 -4
  9. data/lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb +8 -4
  10. data/lib/twilio-ruby/rest/client.rb +10 -1
  11. data/lib/twilio-ruby/rest/notify/v1/service/notification.rb +2 -2
  12. data/lib/twilio-ruby/rest/proxy/v1/service.rb +40 -31
  13. data/lib/twilio-ruby/rest/proxy/v1/service/phone_number.rb +6 -3
  14. data/lib/twilio-ruby/rest/proxy/v1/service/session.rb +28 -28
  15. data/lib/twilio-ruby/rest/proxy/v1/service/session/interaction.rb +13 -7
  16. data/lib/twilio-ruby/rest/proxy/v1/service/session/participant.rb +13 -7
  17. data/lib/twilio-ruby/rest/proxy/v1/service/session/participant/message_interaction.rb +18 -12
  18. data/lib/twilio-ruby/rest/taskrouter/v1/workspace.rb +4 -4
  19. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/event.rb +3 -3
  20. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_cumulative_statistics.rb +2 -2
  21. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_statistics.rb +2 -2
  22. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queues_statistics.rb +6 -6
  23. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb +7 -7
  24. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/reservation.rb +4 -4
  25. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_statistics.rb +6 -6
  26. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/workers_cumulative_statistics.rb +6 -6
  27. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/workers_statistics.rb +6 -6
  28. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow/workflow_cumulative_statistics.rb +2 -2
  29. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow/workflow_statistics.rb +2 -2
  30. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_cumulative_statistics.rb +2 -2
  31. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_statistics.rb +2 -2
  32. data/lib/twilio-ruby/rest/trunking/v1/trunk.rb +19 -4
  33. data/lib/twilio-ruby/twiml/twiml.rb +32 -13
  34. data/lib/twilio-ruby/version.rb +1 -1
  35. data/spec/integration/api/v2010/account/application_spec.rb +5 -11
  36. data/spec/rest/client_spec.rb +12 -0
  37. data/spec/twiml/messaging_response_spec.rb +26 -0
  38. data/spec/twiml/voice_response_spec.rb +25 -0
  39. metadata +3 -3
@@ -76,7 +76,7 @@ module Twilio
76
76
 
77
77
  ##
78
78
  # Fetch a WorkspaceStatisticsInstance
79
- # @param [String] minutes Filter cumulative statistics by up to x minutes in the
79
+ # @param [String] minutes Filter cumulative statistics by up to 'x' minutes in the
80
80
  # past. This is helpful for statistics for the last 15 minutes, 240 minutes (4
81
81
  # hours), and 480 minutes (8 hours) to see trends. Defaults to 15 minutes.
82
82
  # @param [Time] start_date Filter cumulative statistics by a start date. This is
@@ -187,7 +187,7 @@ module Twilio
187
187
 
188
188
  ##
189
189
  # Fetch a WorkspaceStatisticsInstance
190
- # @param [String] minutes Filter cumulative statistics by up to x minutes in the
190
+ # @param [String] minutes Filter cumulative statistics by up to 'x' minutes in the
191
191
  # past. This is helpful for statistics for the last 15 minutes, 240 minutes (4
192
192
  # hours), and 480 minutes (8 hours) to see trends. Defaults to 15 minutes.
193
193
  # @param [Time] start_date Filter cumulative statistics by a start date. This is
@@ -49,7 +49,12 @@ module Twilio
49
49
  # on, all calls going through this trunk will be secure using SRTP for media and
50
50
  # TLS for signalling. If turned off, then RTP will be used for media. See [Secure
51
51
  # Trunking](https://www.twilio.com/docs/sip-trunking/getting-started#securetrunking) for more information.
52
- # @param [Boolean] cnam_lookup_enabled The cnam_lookup_enabled
52
+ # @param [Boolean] cnam_lookup_enabled The Caller ID Name (CNAM) lookup setting
53
+ # for this trunk. If turned on, all inbound calls to this SIP Trunk from the
54
+ # United States and Canada will automatically perform a CNAM Lookup and display
55
+ # Caller ID data on your phone. See
56
+ # [CNAM](https://www.twilio.com/docs/sip-trunking#CNAM) Lookups for more
57
+ # information.
53
58
  # @return [TrunkInstance] Newly created TrunkInstance
54
59
  def create(friendly_name: :unset, domain_name: :unset, disaster_recovery_url: :unset, disaster_recovery_method: :unset, recording: :unset, secure: :unset, cnam_lookup_enabled: :unset)
55
60
  data = Twilio::Values.of({
@@ -256,7 +261,12 @@ module Twilio
256
261
  # on, all calls going through this trunk will be secure using SRTP for media and
257
262
  # TLS for signalling. If turned off, then RTP will be used for media. See [Secure
258
263
  # Trunking](https://www.twilio.com/docs/sip-trunking/getting-started#securetrunking) for more information.
259
- # @param [Boolean] cnam_lookup_enabled The cnam_lookup_enabled
264
+ # @param [Boolean] cnam_lookup_enabled The Caller ID Name (CNAM) lookup setting
265
+ # for this trunk. If turned on, all inbound calls to this SIP Trunk from the
266
+ # United States and Canada will automatically perform a CNAM Lookup and display
267
+ # Caller ID data on your phone. See
268
+ # [CNAM](https://www.twilio.com/docs/sip-trunking#CNAM) Lookups for more
269
+ # information.
260
270
  # @return [TrunkInstance] Updated TrunkInstance
261
271
  def update(friendly_name: :unset, domain_name: :unset, disaster_recovery_url: :unset, disaster_recovery_method: :unset, recording: :unset, secure: :unset, cnam_lookup_enabled: :unset)
262
272
  data = Twilio::Values.of({
@@ -446,7 +456,7 @@ module Twilio
446
456
  end
447
457
 
448
458
  ##
449
- # @return [Boolean] The cnam_lookup_enabled
459
+ # @return [Boolean] The Caller ID Name (CNAM) lookup setting for this trunk.
450
460
  def cnam_lookup_enabled
451
461
  @properties['cnam_lookup_enabled']
452
462
  end
@@ -532,7 +542,12 @@ module Twilio
532
542
  # on, all calls going through this trunk will be secure using SRTP for media and
533
543
  # TLS for signalling. If turned off, then RTP will be used for media. See [Secure
534
544
  # Trunking](https://www.twilio.com/docs/sip-trunking/getting-started#securetrunking) for more information.
535
- # @param [Boolean] cnam_lookup_enabled The cnam_lookup_enabled
545
+ # @param [Boolean] cnam_lookup_enabled The Caller ID Name (CNAM) lookup setting
546
+ # for this trunk. If turned on, all inbound calls to this SIP Trunk from the
547
+ # United States and Canada will automatically perform a CNAM Lookup and display
548
+ # Caller ID data on your phone. See
549
+ # [CNAM](https://www.twilio.com/docs/sip-trunking#CNAM) Lookups for more
550
+ # information.
536
551
  # @return [TrunkInstance] Updated TrunkInstance
537
552
  def update(friendly_name: :unset, domain_name: :unset, disaster_recovery_url: :unset, disaster_recovery_method: :unset, recording: :unset, secure: :unset, cnam_lookup_enabled: :unset)
538
553
  context.update(
@@ -1,24 +1,24 @@
1
1
  require 'nokogiri'
2
2
 
3
- ##
4
- # This code was generated by
5
- # \ / _ _ _| _ _
6
- # | (_)\/(_)(_|\/| |(/_ v1.0.0
7
- # / /
8
- #
9
- # frozen_string_literal: true
10
-
11
3
  module Twilio
12
4
  module TwiML
13
5
  class TwiMLError < StandardError; end
14
6
 
15
- class Comment
16
- def initialize(body)
17
- @body = body
7
+ class LeafNode
8
+ def initialize(content)
9
+ @content = content
18
10
  end
11
+ end
19
12
 
13
+ class Comment < LeafNode
20
14
  def xml(document)
21
- Nokogiri::XML::Comment.new(document, @body)
15
+ Nokogiri::XML::Comment.new(document, @content)
16
+ end
17
+ end
18
+
19
+ class Text < LeafNode
20
+ def xml(document)
21
+ Nokogiri::XML::Text.new(@content, document)
22
22
  end
23
23
  end
24
24
 
@@ -78,7 +78,7 @@ module Twilio
78
78
  end
79
79
 
80
80
  def append(verb)
81
- unless verb.is_a?(TwiML) || verb.is_a?(Comment)
81
+ unless verb.is_a?(TwiML) || verb.is_a?(LeafNode)
82
82
  raise TwiMLError, 'Only appending of TwiML is allowed'
83
83
  end
84
84
 
@@ -90,7 +90,26 @@ module Twilio
90
90
  append(Comment.new(body))
91
91
  end
92
92
 
93
+ def add_text(content)
94
+ append(Text.new(content))
95
+ end
96
+
97
+ def add_child(name, value=nil, **keyword_args)
98
+ node = GenericNode.new(name, value, **keyword_args)
99
+
100
+ yield node if block_given?
101
+ append(node)
102
+ end
103
+
93
104
  alias to_xml to_s
94
105
  end
106
+
107
+ class GenericNode < TwiML
108
+ def initialize(name, value, **keyword_args)
109
+ super(**keyword_args)
110
+ @name = name
111
+ @value = value
112
+ end
113
+ end
95
114
  end
96
115
  end
@@ -1,3 +1,3 @@
1
1
  module Twilio
2
- VERSION = '5.10.3'
2
+ VERSION = '5.10.4'
3
3
  end
@@ -187,14 +187,11 @@ describe 'Application' do
187
187
  ],
188
188
  "end": 0,
189
189
  "first_page_uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Applications.json?PageSize=1&Page=0",
190
- "last_page_uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Applications.json?PageSize=1&Page=35",
191
190
  "next_page_uri": null,
192
- "num_pages": 36,
193
- "page": 0,
194
- "page_size": 1,
195
191
  "previous_page_uri": null,
192
+ "page_size": 1,
193
+ "page": 0,
196
194
  "start": 0,
197
- "total": 36,
198
195
  "uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Applications.json?PageSize=1&Page=0"
199
196
  }
200
197
  ]
@@ -214,14 +211,11 @@ describe 'Application' do
214
211
  "applications": [],
215
212
  "end": 0,
216
213
  "first_page_uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Applications.json?PageSize=1&Page=0",
217
- "last_page_uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Applications.json?PageSize=1&Page=35",
218
- "next_page_uri": null,
219
- "num_pages": 36,
220
- "page": 0,
221
- "page_size": 1,
222
214
  "previous_page_uri": null,
215
+ "page_size": 1,
223
216
  "start": 0,
224
- "total": 36,
217
+ "next_page_uri": null,
218
+ "page": 0,
225
219
  "uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Applications.json?PageSize=1&Page=0"
226
220
  }
227
221
  ]
@@ -47,3 +47,15 @@ describe Twilio::REST::TrunkingClient do
47
47
  expect { Twilio::REST::TrunkingClient.new }.to raise_error(Twilio::REST::ObsoleteError)
48
48
  end
49
49
  end
50
+
51
+ describe Twilio::REST::Client do
52
+ it 'successfully validates the working SSL certificate' do
53
+ @holodeck.mock Twilio::Response.new(200, '')
54
+ expect { @client.validate_ssl_certificate }.not_to raise_error
55
+ end
56
+
57
+ it 'fails to validate broken SSL certificates' do
58
+ @holodeck.mock Twilio::Response.new(504, '')
59
+ expect { @client.validate_ssl_certificate }.to raise_error(Twilio::REST::RestError)
60
+ end
61
+ end
@@ -26,6 +26,32 @@ describe Twilio::TwiML::MessagingResponse do
26
26
  expect(twiml.to_xml).to match(/<!--This is awesome-->/)
27
27
  end
28
28
 
29
+ it 'should allow text nodes' do
30
+ expected_doc = parse <<-XML
31
+ <Response>Look no tags</Response>
32
+ XML
33
+ twiml = Twilio::TwiML::MessagingResponse.new
34
+ twiml.add_text 'Look no tags'
35
+ expect(parse(twiml)).to be_equivalent_to(expected_doc).respecting_element_order
36
+ end
37
+
38
+ it 'should allow generic child nodes' do
39
+ expected_doc = parse <<-XML
40
+ <Response>
41
+ <message tag="global">
42
+ <bold>Hello</bold>
43
+ </alexa>
44
+ </Response>
45
+ XML
46
+
47
+ twiml = Twilio::TwiML::MessagingResponse.new
48
+ twiml.add_child('message', tag: 'global') do |custom|
49
+ custom.add_child('bold', 'Hello')
50
+ end
51
+
52
+ expect(parse(twiml)).to be_equivalent_to(expected_doc).respecting_element_order
53
+ end
54
+
29
55
  it 'should allow populated response' do
30
56
  expected_doc = parse <<-XML
31
57
  <Response>
@@ -36,6 +36,31 @@ describe Twilio::TwiML::VoiceResponse do
36
36
  expect(twiml.to_xml).to match(/<!--This is awesome-->/)
37
37
  end
38
38
 
39
+ it 'should allow text nodes' do
40
+ expected_doc = parse <<-XML
41
+ <Response>Look no tags</Response>
42
+ XML
43
+ twiml = Twilio::TwiML::VoiceResponse.new
44
+ twiml.add_text 'Look no tags'
45
+ expect(parse(twiml)).to be_equivalent_to(expected_doc).respecting_element_order
46
+ end
47
+
48
+ it 'should allow generic child nodes' do
49
+ expected_doc = parse <<-XML
50
+ <Response>
51
+ <alexa omnipresent="true">
52
+ <purchase>Kindle</purchase>
53
+ </alexa>
54
+ </Response>
55
+ XML
56
+
57
+ twiml = Twilio::TwiML::VoiceResponse.new
58
+ twiml.add_child('alexa', omnipresent: 'true') do |alexa|
59
+ alexa.add_child('purchase', 'Kindle')
60
+ end
61
+
62
+ expect(parse(twiml)).to be_equivalent_to(expected_doc).respecting_element_order
63
+ end
39
64
  it 'should allow populated response' do
40
65
  expected_doc = parse <<-XML
41
66
  <Response>
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.10.3
4
+ version: 5.10.4
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: 2018-06-05 00:00:00.000000000 Z
11
+ date: 2018-06-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jwt
@@ -752,7 +752,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
752
752
  version: '0'
753
753
  requirements: []
754
754
  rubyforge_project:
755
- rubygems_version: 2.5.2
755
+ rubygems_version: 2.5.1
756
756
  signing_key:
757
757
  specification_version: 4
758
758
  summary: The official library for communicating with the Twilio REST API, building