twiml_template 2.0.0.pre → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/twiml_template/response.rb +6 -6
- data/lib/twiml_template/version.rb +1 -1
- data/spec/sinatra/twiml_spec.rb +1 -1
- data/spec/tilt/twiml_spec.rb +8 -8
- data/spec/twiml_template/response_spec.rb +14 -14
- data/twiml_template.gemspec +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 815f24857e67744d5bdbc94e479e0f71442fcea5947797a072b0da3791a1537e
|
4
|
+
data.tar.gz: b8d42504ad3fa45dcba94c537315b5097a57e6cb9c88e6c2326bcd333ff35545
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: da385ffd2d382eaaabdcc68f16c11918d5bb6947b9ed22bd5bc9841e6bf025d17d6c3b647b2f9e773c4bb63edd9461db1a57ba0f3685ef2e8ade877e32137b6a
|
7
|
+
data.tar.gz: 1502c094c122595e9ec52498ae8c9a587ad8a7eab6fc847df85172d5af0bcd1287b6d1215a6e0cc52b088402b213bc0669c10537cc3daf2e5097159a32584e75
|
data/README.md
CHANGED
@@ -17,17 +17,17 @@ module TwimlTemplate
|
|
17
17
|
|
18
18
|
def method_missing(method, *args, &block)
|
19
19
|
if (respond_to?(method))
|
20
|
-
if (MESSAGING_VERBS.include?(method
|
21
|
-
if ((MESSAGING_VERBS - VOICE_VERBS).include?(method
|
20
|
+
if (MESSAGING_VERBS.include?(method) && @messaging_response)
|
21
|
+
if ((MESSAGING_VERBS - VOICE_VERBS).include?(method))
|
22
22
|
@voice_response = nil
|
23
23
|
end
|
24
|
-
@messaging_response.send(method
|
24
|
+
@messaging_response.send(method, *args, &block)
|
25
25
|
end
|
26
|
-
if (VOICE_VERBS.include?(method
|
27
|
-
if ((VOICE_VERBS - MESSAGING_VERBS).include?(method
|
26
|
+
if (VOICE_VERBS.include?(method) && @voice_response)
|
27
|
+
if ((VOICE_VERBS - MESSAGING_VERBS).include?(method))
|
28
28
|
@messaging_response = nil
|
29
29
|
end
|
30
|
-
@voice_response.send(method
|
30
|
+
@voice_response.send(method, *args, &block)
|
31
31
|
end
|
32
32
|
else
|
33
33
|
raise ArgumentError.new("Method `#{method}` doesn't exist.")
|
data/spec/sinatra/twiml_spec.rb
CHANGED
data/spec/tilt/twiml_spec.rb
CHANGED
@@ -3,8 +3,8 @@ require 'tilt/twiml'
|
|
3
3
|
|
4
4
|
describe Tilt::TwiML do
|
5
5
|
it "registers for '.twiml' files" do
|
6
|
-
Tilt['test.twiml'].must_equal Tilt::TwiML
|
7
|
-
Tilt['test.xml.twiml'].must_equal Tilt::TwiML
|
6
|
+
expect(Tilt['test.twiml']).must_equal Tilt::TwiML
|
7
|
+
expect(Tilt['test.xml.twiml']).must_equal Tilt::TwiML
|
8
8
|
end
|
9
9
|
|
10
10
|
describe 'simple rendering' do
|
@@ -15,12 +15,12 @@ describe Tilt::TwiML do
|
|
15
15
|
|
16
16
|
it "prepares and evaluates the template on #render" do
|
17
17
|
template = Tilt::TwiML.new { |t| "twiml.say message: 'Hello World!'" }
|
18
|
-
template.render.must_be_equivalent_xml twiml_response
|
18
|
+
expect(template.render).must_be_equivalent_xml twiml_response
|
19
19
|
end
|
20
20
|
|
21
21
|
it "can be rendered more than once" do
|
22
22
|
template = Tilt::TwiML.new { |t| "twiml.say message: 'Hello World!'" }
|
23
|
-
3.times { template.render.must_be_equivalent_xml twiml_response }
|
23
|
+
3.times { expect(template.render).must_be_equivalent_xml twiml_response }
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
@@ -35,7 +35,7 @@ describe Tilt::TwiML do
|
|
35
35
|
template = Tilt::TwiML.new do |t|
|
36
36
|
"twiml.say message: 'Hello ' + name + '!'"
|
37
37
|
end
|
38
|
-
template.render(Object.new, :name => 'Joe').must_be_equivalent_xml twiml_response
|
38
|
+
expect(template.render(Object.new, :name => 'Joe')).must_be_equivalent_xml twiml_response
|
39
39
|
end
|
40
40
|
|
41
41
|
it "evaluates in an object scope" do
|
@@ -44,14 +44,14 @@ describe Tilt::TwiML do
|
|
44
44
|
end
|
45
45
|
scope = Object.new
|
46
46
|
scope.instance_variable_set :@name, 'Joe'
|
47
|
-
template.render(scope).must_be_equivalent_xml twiml_response
|
47
|
+
expect(template.render(scope)).must_be_equivalent_xml twiml_response
|
48
48
|
end
|
49
49
|
|
50
50
|
it "passes a block for yield" do
|
51
51
|
template = Tilt::TwiML.new do |t|
|
52
52
|
"twiml.say message: 'Hello ' + yield + '!'"
|
53
53
|
end
|
54
|
-
3.times { template.render { 'Joe' }.must_be_equivalent_xml twiml_response }
|
54
|
+
3.times { expect(template.render { 'Joe' }).must_be_equivalent_xml twiml_response }
|
55
55
|
end
|
56
56
|
|
57
57
|
it "takes block style templates" do
|
@@ -59,7 +59,7 @@ describe Tilt::TwiML do
|
|
59
59
|
Tilt::TwiML.new do |t|
|
60
60
|
lambda { |twiml| twiml.say(message: 'Hello Joe!') }
|
61
61
|
end
|
62
|
-
template.render.must_be_equivalent_xml twiml_response
|
62
|
+
expect(template.render).must_be_equivalent_xml twiml_response
|
63
63
|
end
|
64
64
|
end
|
65
65
|
end
|
@@ -13,12 +13,12 @@ describe TwimlTemplate::Response do
|
|
13
13
|
|
14
14
|
it 'generates successfully' do
|
15
15
|
response.message(body: "Hello World!")
|
16
|
-
response.to_xml.must_be_equivalent_xml twiml
|
16
|
+
expect(response.to_xml).must_be_equivalent_xml twiml
|
17
17
|
end
|
18
18
|
|
19
19
|
[:message, :redirect].each do |verb|
|
20
20
|
it "responds to #{verb}" do
|
21
|
-
response.must_respond_to(verb)
|
21
|
+
expect(response).must_respond_to(verb)
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
@@ -33,7 +33,7 @@ describe TwimlTemplate::Response do
|
|
33
33
|
response.message do |msg|
|
34
34
|
msg.body "Hello World!"
|
35
35
|
end
|
36
|
-
response.to_xml.must_be_equivalent_xml twiml
|
36
|
+
expect(response.to_xml).must_be_equivalent_xml twiml
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
@@ -46,7 +46,7 @@ describe TwimlTemplate::Response do
|
|
46
46
|
it 'generates successfully' do
|
47
47
|
response.message(body: "Hello World!")
|
48
48
|
response.redirect("http://example.com")
|
49
|
-
response.to_xml.must_be_equivalent_xml twiml
|
49
|
+
expect(response.to_xml).must_be_equivalent_xml twiml
|
50
50
|
end
|
51
51
|
end
|
52
52
|
end
|
@@ -60,12 +60,12 @@ describe TwimlTemplate::Response do
|
|
60
60
|
|
61
61
|
it 'generates successfully' do
|
62
62
|
response.say(message: "Hello World!")
|
63
|
-
response.to_xml.must_be_equivalent_xml twiml
|
63
|
+
expect(response.to_xml).must_be_equivalent_xml twiml
|
64
64
|
end
|
65
65
|
|
66
66
|
(TwimlTemplate::Response::MESSAGING_VERBS | TwimlTemplate::Response::VOICE_VERBS).each do |verb|
|
67
67
|
it "responds to #{verb}" do
|
68
|
-
response.must_respond_to(verb)
|
68
|
+
expect(response).must_respond_to(verb)
|
69
69
|
end
|
70
70
|
end
|
71
71
|
end
|
@@ -80,7 +80,7 @@ describe TwimlTemplate::Response do
|
|
80
80
|
response.gather do |gather|
|
81
81
|
gather.say message: "Hello World!"
|
82
82
|
end
|
83
|
-
response.to_xml.must_be_equivalent_xml twiml
|
83
|
+
expect(response.to_xml).must_be_equivalent_xml twiml
|
84
84
|
end
|
85
85
|
end
|
86
86
|
|
@@ -93,31 +93,31 @@ describe TwimlTemplate::Response do
|
|
93
93
|
it 'generates successfully' do
|
94
94
|
response.say(message: "Hello World!")
|
95
95
|
response.play(url: "http://tunes.com")
|
96
|
-
response.to_xml.must_be_equivalent_xml twiml
|
96
|
+
expect(response.to_xml).must_be_equivalent_xml twiml
|
97
97
|
end
|
98
98
|
end
|
99
99
|
end
|
100
100
|
|
101
101
|
describe 'with a mixed response' do
|
102
102
|
it 'should raise an error' do
|
103
|
-
proc do
|
103
|
+
expect(proc do
|
104
104
|
response.say(message: "Hello")
|
105
105
|
response.message(" World!")
|
106
|
-
end.must_raise ArgumentError
|
106
|
+
end).must_raise ArgumentError
|
107
107
|
end
|
108
108
|
|
109
109
|
it 'should allow a redirect and a message' do
|
110
|
-
proc do
|
110
|
+
expect(proc do
|
111
111
|
response.redirect("http://example.com")
|
112
112
|
response.message(body: "Hello World!")
|
113
|
-
end.must_be_silent
|
113
|
+
end).must_be_silent
|
114
114
|
end
|
115
115
|
|
116
116
|
it 'should allow a redirect and a voice verb' do
|
117
|
-
proc do
|
117
|
+
expect(proc do
|
118
118
|
response.redirect("http://example.com")
|
119
119
|
response.say(message: "Hello World!")
|
120
|
-
end.must_be_silent
|
120
|
+
end).must_be_silent
|
121
121
|
end
|
122
122
|
end
|
123
123
|
end
|
data/twiml_template.gemspec
CHANGED
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
|
|
24
24
|
|
25
25
|
spec.add_development_dependency "bundler", ">= 1.7", "< 3.0"
|
26
26
|
spec.add_development_dependency "rake", "~> 10.0"
|
27
|
-
spec.add_development_dependency "minitest", "~> 5.
|
27
|
+
spec.add_development_dependency "minitest", "~> 5.12"
|
28
28
|
spec.add_development_dependency "rack-test"
|
29
29
|
spec.add_development_dependency "sinatra", ">= 1.3"
|
30
30
|
spec.add_development_dependency "equivalent-xml", "~> 0.6.0"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: twiml_template
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.0
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Phil Nash
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-10
|
11
|
+
date: 2019-11-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: tilt
|
@@ -90,14 +90,14 @@ dependencies:
|
|
90
90
|
requirements:
|
91
91
|
- - "~>"
|
92
92
|
- !ruby/object:Gem::Version
|
93
|
-
version: '5.
|
93
|
+
version: '5.12'
|
94
94
|
type: :development
|
95
95
|
prerelease: false
|
96
96
|
version_requirements: !ruby/object:Gem::Requirement
|
97
97
|
requirements:
|
98
98
|
- - "~>"
|
99
99
|
- !ruby/object:Gem::Version
|
100
|
-
version: '5.
|
100
|
+
version: '5.12'
|
101
101
|
- !ruby/object:Gem::Dependency
|
102
102
|
name: rack-test
|
103
103
|
requirement: !ruby/object:Gem::Requirement
|
@@ -183,9 +183,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
183
183
|
version: 1.9.3
|
184
184
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
185
185
|
requirements:
|
186
|
-
- - "
|
186
|
+
- - ">="
|
187
187
|
- !ruby/object:Gem::Version
|
188
|
-
version:
|
188
|
+
version: '0'
|
189
189
|
requirements: []
|
190
190
|
rubygems_version: 3.0.3
|
191
191
|
signing_key:
|