plivo 4.16.0 → 4.58.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/unitTests.yml +32 -0
- data/.gitignore +1 -0
- data/CHANGELOG.md +225 -0
- data/Dockerfile +12 -0
- data/Gemfile +1 -0
- data/Makefile +18 -0
- data/README.md +389 -20
- data/docker-compose.yml +18 -0
- data/examples/tollfree_verification.rb +42 -0
- data/lib/plivo/base/resource.rb +30 -0
- data/lib/plivo/base/resource_interface.rb +18 -2
- data/lib/plivo/base.rb +3 -3
- data/lib/plivo/base_client.rb +9 -9
- data/lib/plivo/interactive.rb +139 -0
- data/lib/plivo/location.rb +22 -0
- data/lib/plivo/resources/brand.rb +98 -0
- data/lib/plivo/resources/call_feedback.rb +0 -1
- data/lib/plivo/resources/calls.rb +183 -29
- data/lib/plivo/resources/campaign.rb +168 -0
- data/lib/plivo/resources/messages.rb +392 -58
- data/lib/plivo/resources/multipartycalls.rb +637 -0
- data/lib/plivo/resources/numbers.rb +40 -7
- data/lib/plivo/resources/profile.rb +93 -0
- data/lib/plivo/resources/recordings.rb +29 -2
- data/lib/plivo/resources/token.rb +66 -0
- data/lib/plivo/resources/tollfree_verification.rb +178 -0
- data/lib/plivo/resources/verify_caller_id.rb +110 -0
- data/lib/plivo/resources/verify_session.rb +106 -0
- data/lib/plivo/resources.rb +8 -0
- data/lib/plivo/rest_client.rb +14 -1
- data/lib/plivo/template.rb +102 -0
- data/lib/plivo/utils.rb +112 -1
- data/lib/plivo/version.rb +1 -1
- data/lib/plivo/xml/cont.rb +13 -0
- data/lib/plivo/xml/dial.rb +1 -1
- data/lib/plivo/xml/element.rb +9 -2
- data/lib/plivo/xml/emphasis.rb +1 -1
- data/lib/plivo/xml/lang.rb +1 -1
- data/lib/plivo/xml/multipartycall.rb +216 -0
- data/lib/plivo/xml/p.rb +1 -1
- data/lib/plivo/xml/plivo_xml.rb +2 -2
- data/lib/plivo/xml/prosody.rb +1 -1
- data/lib/plivo/xml/response.rb +1 -1
- data/lib/plivo/xml/s.rb +1 -1
- data/lib/plivo/xml/speak.rb +1 -1
- data/lib/plivo/xml/stream.rb +27 -0
- data/lib/plivo/xml/w.rb +1 -1
- data/lib/plivo/xml.rb +3 -1
- data/plivo.gemspec +1 -2
- data/setup_sdk.sh +47 -0
- metadata +24 -19
- data/.travis.yml +0 -11
@@ -0,0 +1,216 @@
|
|
1
|
+
module Plivo
|
2
|
+
module XML
|
3
|
+
class MultiPartyCall < Element
|
4
|
+
@nestables = []
|
5
|
+
@valid_attributes = %w[role maxDuration maxParticipants waitMusicUrl
|
6
|
+
waitMusicMethod agentHoldMusicUrl agentHoldMusicMethod
|
7
|
+
customerHoldMusicUrl customerHoldMusicMethod record
|
8
|
+
recordFileFormat recordingCallbackUrl recordingCallbackMethod
|
9
|
+
statusCallbackEvents statusCallbackUrl statusCallbackMethod
|
10
|
+
stayAlone coachMode mute hold startMpcOnEnter endMpcOnExit
|
11
|
+
enterSound enterSoundMethod exitSound exitSoundMethod
|
12
|
+
onExitActionUrl onExitActionMethod relayDTMFInputs
|
13
|
+
startRecordingAudio startRecordingAudioMethod
|
14
|
+
stopRecordingAudio stopRecordingAudioMethod recordMinMemberCount]
|
15
|
+
|
16
|
+
VALID_ROLE_VALUES = %w[agent supervisor customer]
|
17
|
+
VALID_METHOD_VALUES = %w[GET POST]
|
18
|
+
VALID_BOOL_VALUES = [true, false]
|
19
|
+
VALID_RECORD_FILE_FORMAT_VALUES = %w[mp3 wav]
|
20
|
+
|
21
|
+
def initialize(body, attributes = {})
|
22
|
+
if attributes[:role] && !VALID_ROLE_VALUES.include?(attributes[:role].downcase)
|
23
|
+
raise PlivoXMLError, "invalid attribute value #{attributes[:role]} for role"
|
24
|
+
elsif !attributes[:role]
|
25
|
+
raise PlivoXMLError, "role not mentioned : possible values - Agent / Supervisor / Customer"
|
26
|
+
end
|
27
|
+
|
28
|
+
if attributes[:maxDuration] && (attributes[:maxDuration]<300 || attributes[:maxDuration]>28800)
|
29
|
+
raise PlivoXMLError, "invalid attribute value #{attributes[:maxDuration]} for maxDuration"
|
30
|
+
elsif !attributes[:maxDuration]
|
31
|
+
attributes[:maxDuration] = 14400
|
32
|
+
end
|
33
|
+
|
34
|
+
if attributes[:maxParticipants] && (attributes[:maxParticipants]<2 || attributes[:maxParticipants]>10)
|
35
|
+
raise PlivoXMLError, "invalid attribute value #{attributes[:maxParticipants]} for maxParticipants"
|
36
|
+
elsif !attributes[:maxParticipants]
|
37
|
+
attributes[:maxParticipants] = 10
|
38
|
+
end
|
39
|
+
|
40
|
+
if attributes[:recordMinMemberCount] && (attributes[:recordMinMemberCount]<1 || attributes[:recordMinMemberCount]>2)
|
41
|
+
raise PlivoXMLError, "invalid attribute value #{attributes[:recordMinMemberCount]} for recordMinMemberCount"
|
42
|
+
elsif !attributes[:recordMinMemberCount]
|
43
|
+
attributes[:recordMinMemberCount] = 1
|
44
|
+
end
|
45
|
+
|
46
|
+
if attributes[:waitMusicMethod] && !VALID_METHOD_VALUES.include?(attributes[:waitMusicMethod].upcase)
|
47
|
+
raise PlivoXMLError, "invalid attribute value #{attributes[:waitMusicMethod]} for waitMusicMethod"
|
48
|
+
elsif !attributes[:waitMusicMethod]
|
49
|
+
attributes[:waitMusicMethod] = 'GET'
|
50
|
+
end
|
51
|
+
|
52
|
+
if attributes[:agentHoldMusicMethod] && !VALID_METHOD_VALUES.include?(attributes[:agentHoldMusicMethod].upcase)
|
53
|
+
raise PlivoXMLError, "invalid attribute value #{attributes[:agentHoldMusicMethod]} for agentHoldMusicMethod"
|
54
|
+
elsif !attributes[:agentHoldMusicMethod]
|
55
|
+
attributes[:agentHoldMusicMethod] = 'GET'
|
56
|
+
end
|
57
|
+
|
58
|
+
if attributes[:customerHoldMusicMethod] && !VALID_METHOD_VALUES.include?(attributes[:customerHoldMusicMethod].upcase)
|
59
|
+
raise PlivoXMLError, "invalid attribute value #{attributes[:customerHoldMusicMethod]} for customerHoldMusicMethod"
|
60
|
+
elsif !attributes[:customerHoldMusicMethod]
|
61
|
+
attributes[:customerHoldMusicMethod] = 'GET'
|
62
|
+
end
|
63
|
+
|
64
|
+
if attributes[:record] && !VALID_BOOL_VALUES.include?(attributes[:record])
|
65
|
+
raise PlivoXMLError, "invalid attribute value #{attributes[:record]} for record"
|
66
|
+
elsif !attributes[:record]
|
67
|
+
attributes[:record] = false
|
68
|
+
end
|
69
|
+
|
70
|
+
if attributes[:recordFileFormat] && !VALID_RECORD_FILE_FORMAT_VALUES.include?(attributes[:recordFileFormat])
|
71
|
+
raise PlivoXMLError, "invalid attribute value #{attributes[:recordFileFormat]} for recordFileFormat"
|
72
|
+
elsif !attributes[:recordFileFormat]
|
73
|
+
attributes[:recordFileFormat] = 'mp3'
|
74
|
+
end
|
75
|
+
|
76
|
+
if attributes[:recordingCallbackMethod] && !VALID_METHOD_VALUES.include?(attributes[:recordingCallbackMethod].upcase)
|
77
|
+
raise PlivoXMLError, "invalid attribute value #{attributes[:recordingCallbackMethod]} for recordingCallbackMethod"
|
78
|
+
elsif !attributes[:recordingCallbackMethod]
|
79
|
+
attributes[:recordingCallbackMethod] = 'GET'
|
80
|
+
end
|
81
|
+
|
82
|
+
if attributes[:statusCallbackEvents] && !multi_valid_param?(:statusCallbackEvents, attributes[:statusCallbackEvents], String, false, %w[mpc-state-changes participant-state-changes participant-speak-events participant-digit-input-events add-participant-api-events], true, ',') == true
|
83
|
+
raise PlivoXMLError, "invalid attribute value #{attributes[:statusCallbackEvents]} for statusCallbackEvents"
|
84
|
+
elsif !attributes[:statusCallbackEvents]
|
85
|
+
attributes[:statusCallbackEvents] = 'mpc-state-changes,participant-state-changes'
|
86
|
+
end
|
87
|
+
|
88
|
+
if attributes[:statusCallbackMethod] && !VALID_METHOD_VALUES.include?(attributes[:statusCallbackMethod].upcase)
|
89
|
+
raise PlivoXMLError, "invalid attribute value #{attributes[:statusCallbackMethod]} for statusCallbackMethod"
|
90
|
+
elsif !attributes[:statusCallbackMethod]
|
91
|
+
attributes[:statusCallbackMethod] = 'POST'
|
92
|
+
end
|
93
|
+
|
94
|
+
if attributes[:stayAlone] && !VALID_BOOL_VALUES.include?(attributes[:stayAlone])
|
95
|
+
raise PlivoXMLError, "invalid attribute value #{attributes[:stayAlone]} for stayAlone"
|
96
|
+
elsif !attributes[:stayAlone]
|
97
|
+
attributes[:stayAlone] = false
|
98
|
+
end
|
99
|
+
|
100
|
+
if attributes[:coachMode] && !VALID_BOOL_VALUES.include?(attributes[:coachMode])
|
101
|
+
raise PlivoXMLError, "invalid attribute value #{attributes[:coachMode]} for coachMode"
|
102
|
+
elsif !attributes[:coachMode]
|
103
|
+
attributes[:coachMode] = true
|
104
|
+
end
|
105
|
+
|
106
|
+
if attributes[:mute] && !VALID_BOOL_VALUES.include?(attributes[:mute])
|
107
|
+
raise PlivoXMLError, "invalid attribute value #{attributes[:mute]} for mute"
|
108
|
+
elsif !attributes[:mute]
|
109
|
+
attributes[:mute] = false
|
110
|
+
end
|
111
|
+
|
112
|
+
if attributes[:hold] && !VALID_BOOL_VALUES.include?(attributes[:hold])
|
113
|
+
raise PlivoXMLError, "invalid attribute value #{attributes[:hold]} for hold"
|
114
|
+
elsif !attributes[:hold]
|
115
|
+
attributes[:hold] = false
|
116
|
+
end
|
117
|
+
|
118
|
+
if attributes[:startMpcOnEnter] && !VALID_BOOL_VALUES.include?(attributes[:startMpcOnEnter])
|
119
|
+
raise PlivoXMLError, "invalid attribute value #{attributes[:startMpcOnEnter]} for startMpcOnEnter"
|
120
|
+
elsif !attributes[:startMpcOnEnter]
|
121
|
+
attributes[:startMpcOnEnter] = true
|
122
|
+
end
|
123
|
+
|
124
|
+
if attributes[:endMpcOnExit] && !VALID_BOOL_VALUES.include?(attributes[:endMpcOnExit])
|
125
|
+
raise PlivoXMLError, "invalid attribute value #{attributes[:endMpcOnExit]} for endMpcOnExit"
|
126
|
+
elsif !attributes[:endMpcOnExit]
|
127
|
+
attributes[:endMpcOnExit] = false
|
128
|
+
end
|
129
|
+
|
130
|
+
if attributes[:enterSound] && !is_one_among_string_url?(:enterSound, attributes[:enterSound], false, %w[beep:1 beep:2 none])
|
131
|
+
raise PlivoXMLError, "invalid attribute value #{attributes[:enterSound]} for enterSound"
|
132
|
+
elsif !attributes[:enterSound]
|
133
|
+
attributes[:enterSound] = 'beep:1'
|
134
|
+
end
|
135
|
+
|
136
|
+
if attributes[:enterSoundMethod] && !VALID_METHOD_VALUES.include?(attributes[:enterSoundMethod].upcase)
|
137
|
+
raise PlivoXMLError, "invalid attribute value #{attributes[:enterSoundMethod]} for enterSoundMethod"
|
138
|
+
elsif !attributes[:enterSoundMethod]
|
139
|
+
attributes[:enterSoundMethod] = 'GET'
|
140
|
+
end
|
141
|
+
|
142
|
+
if attributes[:exitSound] && !is_one_among_string_url?(:exitSound, attributes[:exitSound], false, %w[beep:1 beep:2 none])
|
143
|
+
raise PlivoXMLError, "invalid attribute value #{attributes[:exitSound]} for exitSound"
|
144
|
+
elsif !attributes[:exitSound]
|
145
|
+
attributes[:exitSound] = 'beep:2'
|
146
|
+
end
|
147
|
+
|
148
|
+
if attributes[:exitSoundMethod] && !VALID_METHOD_VALUES.include?(attributes[:exitSoundMethod].upcase)
|
149
|
+
raise PlivoXMLError, "invalid attribute value #{attributes[:exitSoundMethod]} for exitSoundMethod"
|
150
|
+
elsif !attributes[:exitSoundMethod]
|
151
|
+
attributes[:exitSoundMethod] = 'GET'
|
152
|
+
end
|
153
|
+
|
154
|
+
if attributes[:onExitActionMethod] && !VALID_METHOD_VALUES.include?(attributes[:onExitActionMethod].upcase)
|
155
|
+
raise PlivoXMLError, "invalid attribute value #{attributes[:onExitActionMethod]} for onExitActionMethod"
|
156
|
+
elsif !attributes[:onExitActionMethod]
|
157
|
+
attributes[:onExitActionMethod] = 'POST'
|
158
|
+
end
|
159
|
+
|
160
|
+
if attributes[:relayDTMFInputs] && !VALID_BOOL_VALUES.include?(attributes[:relayDTMFInputs])
|
161
|
+
raise PlivoXMLError, "invalid attribute value #{attributes[:relayDTMFInputs]} for relayDTMFInputs"
|
162
|
+
elsif !attributes[:relayDTMFInputs]
|
163
|
+
attributes[:relayDTMFInputs] = false
|
164
|
+
end
|
165
|
+
|
166
|
+
if attributes[:waitMusicUrl] && !valid_url?(:waitMusicUrl, attributes[:waitMusicUrl], false)
|
167
|
+
raise PlivoXMLError, "invalid attribute value #{attributes[:waitMusicUrl]} for waitMusicUrl"
|
168
|
+
end
|
169
|
+
|
170
|
+
if attributes[:agentHoldMusicUrl] && !valid_url?(:agentHoldMusicUrl, attributes[:agentHoldMusicUrl], false)
|
171
|
+
raise PlivoXMLError, "invalid attribute value #{attributes[:agentHoldMusicUrl]} for agentHoldMusicUrl"
|
172
|
+
end
|
173
|
+
|
174
|
+
if attributes[:customerHoldMusicUrl] && !valid_url?(:customerHoldMusicUrl, attributes[:customerHoldMusicUrl], false)
|
175
|
+
raise PlivoXMLError, "invalid attribute value #{attributes[:customerHoldMusicUrl]} for customerHoldMusicUrl"
|
176
|
+
end
|
177
|
+
|
178
|
+
if attributes[:recordingCallbackUrl] && !valid_url?(:recordingCallbackUrl, attributes[:recordingCallbackUrl], false)
|
179
|
+
raise PlivoXMLError, "invalid attribute value #{attributes[:recordingCallbackUrl]} for recordingCallbackUrl"
|
180
|
+
end
|
181
|
+
|
182
|
+
if attributes[:statusCallbackUrl] && !valid_url?(:statusCallbackUrl, attributes[:statusCallbackUrl], false)
|
183
|
+
raise PlivoXMLError, "invalid attribute value #{attributes[:statusCallbackUrl]} for statusCallbackUrl"
|
184
|
+
end
|
185
|
+
|
186
|
+
if attributes[:customerHoldMusicUrl] && !valid_url?(:customerHoldMusicUrl, attributes[:customerHoldMusicUrl], false)
|
187
|
+
raise PlivoXMLError, "invalid attribute value #{attributes[:customerHoldMusicUrl]} for customerHoldMusicUrl"
|
188
|
+
end
|
189
|
+
|
190
|
+
if attributes[:startRecordingAudio] && !valid_url?(:startRecordingAudio, attributes[:startRecordingAudio], false)
|
191
|
+
raise PlivoXMLError, "invalid attribute value #{attributes[:startRecordingAudio]} for startRecordingAudio"
|
192
|
+
end
|
193
|
+
|
194
|
+
if attributes[:stopRecordingAudio] && !valid_url?(:stopRecordingAudio, attributes[:stopRecordingAudio], false)
|
195
|
+
raise PlivoXMLError, "invalid attribute value #{attributes[:stopRecordingAudio]} for stopRecordingAudio"
|
196
|
+
end
|
197
|
+
|
198
|
+
if attributes[:startRecordingAudioMethod] && !VALID_METHOD_VALUES.include?(attributes[:startRecordingAudioMethod].upcase)
|
199
|
+
raise PlivoXMLError, "invalid attribute value #{attributes[:startRecordingAudioMethod]} for startRecordingAudioMethod"
|
200
|
+
elsif !attributes[:startRecordingAudioMethod]
|
201
|
+
attributes[:startRecordingAudioMethod] = 'GET'
|
202
|
+
end
|
203
|
+
|
204
|
+
if attributes[:stopRecordingAudioMethod] && !VALID_METHOD_VALUES.include?(attributes[:stopRecordingAudioMethod].upcase)
|
205
|
+
raise PlivoXMLError, "invalid attribute value #{attributes[:stopRecordingAudioMethod]} for stopRecordingAudioMethod"
|
206
|
+
elsif !attributes[:stopRecordingAudioMethod]
|
207
|
+
attributes[:stopRecordingAudioMethod] = 'GET'
|
208
|
+
end
|
209
|
+
|
210
|
+
raise PlivoXMLError, 'No MPC name set for the MPC' unless body
|
211
|
+
super(body, attributes)
|
212
|
+
end
|
213
|
+
|
214
|
+
end
|
215
|
+
end
|
216
|
+
end
|
data/lib/plivo/xml/p.rb
CHANGED
data/lib/plivo/xml/plivo_xml.rb
CHANGED
@@ -8,11 +8,11 @@ module Plivo
|
|
8
8
|
end
|
9
9
|
|
10
10
|
def to_xml
|
11
|
-
'<?xml version="1.0" encoding="utf-8" ?>' + @response.to_xml
|
11
|
+
'<?xml version="1.0" encoding="utf-8" ?>' + @response.to_xml.gsub(""", "\"")
|
12
12
|
end
|
13
13
|
|
14
14
|
def to_s
|
15
|
-
'<?xml version="1.0" encoding="utf-8" ?>' + @response.to_s
|
15
|
+
'<?xml version="1.0" encoding="utf-8" ?>' + @response.to_s.gsub(""", "\"")
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
data/lib/plivo/xml/prosody.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Plivo
|
2
2
|
module XML
|
3
3
|
class Prosody < Element
|
4
|
-
@nestables = %w(Break Emphasis Lang P Phoneme Prosody S SayAs Sub W)
|
4
|
+
@nestables = %w(Break Cont Emphasis Lang P Phoneme Prosody S SayAs Sub W)
|
5
5
|
@valid_attributes = %w(volume rate pitch)
|
6
6
|
|
7
7
|
VALID_VOLUME_ATTRIBUTE_VALUES=%w(default silent x-soft soft medium loud x-loud)
|
data/lib/plivo/xml/response.rb
CHANGED
@@ -2,7 +2,7 @@ module Plivo
|
|
2
2
|
module XML
|
3
3
|
class Response < Element
|
4
4
|
@nestables = %w[Speak Play GetDigits GetInput Record Dial Message
|
5
|
-
Redirect Wait Hangup PreAnswer Conference DTMF]
|
5
|
+
Redirect Wait Hangup PreAnswer Conference DTMF MultiPartyCall Stream]
|
6
6
|
@valid_attributes = []
|
7
7
|
|
8
8
|
def initialize
|
data/lib/plivo/xml/s.rb
CHANGED
data/lib/plivo/xml/speak.rb
CHANGED
@@ -13,7 +13,7 @@ module Plivo
|
|
13
13
|
engine = attributes[:voice].split('.')[0]
|
14
14
|
voice = attributes[:voice].split('.')[1]
|
15
15
|
if SUPPORTED_ENGINES.include?(engine) && SUPPORTED_VOICES.include?(voice)
|
16
|
-
@nestables = %w(Break Emphasis Lang P Phoneme Prosody S SayAs Sub W)
|
16
|
+
@nestables = %w(Break Cont Emphasis Lang P Phoneme Prosody S SayAs Sub W)
|
17
17
|
else
|
18
18
|
raise PlivoXMLError, "<Speak> voice #{attributes[:voice]} is not valid."
|
19
19
|
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Plivo
|
2
|
+
module XML
|
3
|
+
class Stream < Element
|
4
|
+
@nestables = []
|
5
|
+
@valid_attributes = %w[bidirectional audioTrack streamTimeout statusCallbackUrl
|
6
|
+
statusCallbackMethod contentType extraHeaders]
|
7
|
+
|
8
|
+
SUPPORTED_BIDIRECTIONAL=%w(true false)
|
9
|
+
SUPPORTED_AUDIOTRACK=%w(inbound outbound both)
|
10
|
+
SUPPORTED_CALLBACKMETHOD=%w(GET POST)
|
11
|
+
|
12
|
+
def initialize(body, attributes = {})
|
13
|
+
if attributes[:bidirectional] && !SUPPORTED_BIDIRECTIONAL.include?(attributes[:bidirectional])
|
14
|
+
raise PlivoXMLError, "<Stream> bidirectional #{attributes[:bidirectional]} is not valid."
|
15
|
+
end
|
16
|
+
if attributes[:audioTrack] && !SUPPORTED_AUDIOTRACK.include?(attributes[:audioTrack])
|
17
|
+
raise PlivoXMLError, "<Stream> audioTrack #{attributes[:audioTrack]} is not valid."
|
18
|
+
end
|
19
|
+
if attributes[:statusCallbackMethod] && !SUPPORTED_CALLBACKMETHOD.include?(attributes[:statusCallbackMethod].upcase)
|
20
|
+
raise PlivoXMLError, "<Stream> statusCallbackMethod #{attributes[:statusCallbackMethod]} is not valid."
|
21
|
+
end
|
22
|
+
raise PlivoXMLError, 'No text set for Stream' unless body
|
23
|
+
super(body, attributes)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
data/lib/plivo/xml/w.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
module Plivo
|
2
2
|
module XML
|
3
3
|
class W < Element
|
4
|
-
@nestables = %w(Break Emphasis Phoneme Prosody SayAs Sub)
|
4
|
+
@nestables = %w(Break Cont Emphasis Phoneme Prosody SayAs Sub)
|
5
5
|
@valid_attributes = %w(role)
|
6
6
|
|
7
7
|
VALID_ROLE_ATTRIBUTE_VALUES=%w(amazon:VB amazon:VBD amazon:SENSE_1)
|
data/lib/plivo/xml.rb
CHANGED
@@ -29,7 +29,9 @@ require_relative 'xml/say_as'
|
|
29
29
|
require_relative 'xml/sub'
|
30
30
|
require_relative 'xml/w'
|
31
31
|
require_relative 'xml/plivo_xml'
|
32
|
-
|
32
|
+
require_relative 'xml/multipartycall'
|
33
|
+
require_relative 'xml/cont'
|
34
|
+
require_relative 'xml/stream'
|
33
35
|
include Plivo::Exceptions
|
34
36
|
|
35
37
|
module Plivo
|
data/plivo.gemspec
CHANGED
@@ -31,8 +31,7 @@ Gem::Specification.new do |spec|
|
|
31
31
|
|
32
32
|
spec.required_ruby_version = '>= 2.0.0'
|
33
33
|
|
34
|
-
spec.add_dependency 'faraday', '~>
|
35
|
-
spec.add_dependency 'faraday_middleware', '~> 1.0.0'
|
34
|
+
spec.add_dependency 'faraday', '~> 2.7'
|
36
35
|
spec.add_dependency 'htmlentities'
|
37
36
|
spec.add_dependency 'jwt'
|
38
37
|
|
data/setup_sdk.sh
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
set -e
|
4
|
+
testDir="ruby-sdk-test"
|
5
|
+
GREEN="\033[0;32m"
|
6
|
+
NC="\033[0m"
|
7
|
+
|
8
|
+
if [ ! $PLIVO_API_PROD_HOST ] || [ ! $PLIVO_API_DEV_HOST ] || [ ! $PLIVO_AUTH_ID ] || [ ! $PLIVO_AUTH_TOKEN ]; then
|
9
|
+
echo "Environment variables not properly set! Please refer to Local Development section in README!"
|
10
|
+
exit 126
|
11
|
+
fi
|
12
|
+
|
13
|
+
cd /usr/src/app
|
14
|
+
|
15
|
+
echo "Setting plivo-api endpoint to dev..."
|
16
|
+
find /usr/src/app/lib/ -type f -exec sed -i "s/$PLIVO_API_PROD_HOST/$PLIVO_API_DEV_HOST/g" {} \;
|
17
|
+
|
18
|
+
bundle install
|
19
|
+
|
20
|
+
if [ ! -d $testDir ]; then
|
21
|
+
echo "Creating test dir..."
|
22
|
+
mkdir -p $testDir
|
23
|
+
fi
|
24
|
+
|
25
|
+
if [ ! -f $testDir/test.rb ]; then
|
26
|
+
echo "Creating test file..."
|
27
|
+
cd $testDir
|
28
|
+
echo -e "require \"rubygems\"" > test.rb
|
29
|
+
echo -e "require \"/usr/src/app/lib/plivo.rb\"" >> test.rb
|
30
|
+
echo -e "include Plivo\n" >> test.rb
|
31
|
+
echo -e "api = RestClient.new(ENV[\"PLIVO_AUTH_ID\"], ENV[\"PLIVO_AUTH_TOKEN\"])" >> test.rb
|
32
|
+
cd -
|
33
|
+
fi
|
34
|
+
|
35
|
+
echo -e "\n\nSDK setup complete! You can test changes either on host or inside the docker container:"
|
36
|
+
echo -e "\ta. To test your changes ON HOST:"
|
37
|
+
echo -e "\t\t1. Add your test code in <path_to_cloned_sdk>/$testDir/test.rb"
|
38
|
+
echo -e "\t\t2. Run your test file using: $GREEN make run CONTAINER=$HOSTNAME$NC"
|
39
|
+
echo -e "\t\t3. Run unit tests using: $GREEN make test CONTAINER=$HOSTNAME$NC"
|
40
|
+
echo
|
41
|
+
echo -e "\tb. To test your changes INSIDE CONTAINER:"
|
42
|
+
echo -e "\t\t1. Run a terminal in the container using: $GREEN docker exec -it $HOSTNAME /bin/bash$NC"
|
43
|
+
echo -e "\t\t2. Add your test code in /usr/src/app/$testDir/test.rb"
|
44
|
+
echo -e "\t\t3. Run your test file using: $GREEN make run$NC"
|
45
|
+
echo -e "\t\t4. Run unit tests using: $GREEN make test$NC"
|
46
|
+
# To keep the container running post setup
|
47
|
+
/bin/bash
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: plivo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.58.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- The Plivo SDKs Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-05-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -16,28 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: '2.7'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: faraday_middleware
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: 1.0.0
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: 1.0.0
|
26
|
+
version: '2.7'
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
28
|
name: htmlentities
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -152,23 +138,27 @@ executables: []
|
|
152
138
|
extensions: []
|
153
139
|
extra_rdoc_files: []
|
154
140
|
files:
|
141
|
+
- ".github/workflows/unitTests.yml"
|
155
142
|
- ".gitignore"
|
156
143
|
- ".rspec"
|
157
|
-
- ".travis.yml"
|
158
144
|
- AUTHORS.md
|
159
145
|
- CHANGELOG.md
|
146
|
+
- Dockerfile
|
160
147
|
- Gemfile
|
161
148
|
- Jenkinsfile
|
162
149
|
- LICENSE.txt
|
150
|
+
- Makefile
|
163
151
|
- README.md
|
164
152
|
- Rakefile
|
165
153
|
- ci/config.yml
|
154
|
+
- docker-compose.yml
|
166
155
|
- examples/conference_bridge.rb
|
167
156
|
- examples/jwt.rb
|
168
157
|
- examples/lookup.rb
|
169
158
|
- examples/multi_party_call.rb
|
170
159
|
- examples/phlos.rb
|
171
160
|
- examples/regulatory_compliance.rb
|
161
|
+
- examples/tollfree_verification.rb
|
172
162
|
- lib/plivo.rb
|
173
163
|
- lib/plivo/base.rb
|
174
164
|
- lib/plivo/base/resource.rb
|
@@ -176,34 +166,46 @@ files:
|
|
176
166
|
- lib/plivo/base/response.rb
|
177
167
|
- lib/plivo/base_client.rb
|
178
168
|
- lib/plivo/exceptions.rb
|
169
|
+
- lib/plivo/interactive.rb
|
179
170
|
- lib/plivo/jwt.rb
|
171
|
+
- lib/plivo/location.rb
|
180
172
|
- lib/plivo/phlo_client.rb
|
181
173
|
- lib/plivo/resources.rb
|
182
174
|
- lib/plivo/resources/accounts.rb
|
183
175
|
- lib/plivo/resources/addresses.rb
|
184
176
|
- lib/plivo/resources/applications.rb
|
177
|
+
- lib/plivo/resources/brand.rb
|
185
178
|
- lib/plivo/resources/call_feedback.rb
|
186
179
|
- lib/plivo/resources/calls.rb
|
180
|
+
- lib/plivo/resources/campaign.rb
|
187
181
|
- lib/plivo/resources/conferences.rb
|
188
182
|
- lib/plivo/resources/endpoints.rb
|
189
183
|
- lib/plivo/resources/identities.rb
|
190
184
|
- lib/plivo/resources/lookup.rb
|
191
185
|
- lib/plivo/resources/media.rb
|
192
186
|
- lib/plivo/resources/messages.rb
|
187
|
+
- lib/plivo/resources/multipartycalls.rb
|
193
188
|
- lib/plivo/resources/nodes.rb
|
194
189
|
- lib/plivo/resources/numbers.rb
|
195
190
|
- lib/plivo/resources/phlo_member.rb
|
196
191
|
- lib/plivo/resources/phlos.rb
|
197
192
|
- lib/plivo/resources/powerpacks.rb
|
198
193
|
- lib/plivo/resources/pricings.rb
|
194
|
+
- lib/plivo/resources/profile.rb
|
199
195
|
- lib/plivo/resources/recordings.rb
|
200
196
|
- lib/plivo/resources/regulatory_compliance.rb
|
197
|
+
- lib/plivo/resources/token.rb
|
198
|
+
- lib/plivo/resources/tollfree_verification.rb
|
199
|
+
- lib/plivo/resources/verify_caller_id.rb
|
200
|
+
- lib/plivo/resources/verify_session.rb
|
201
201
|
- lib/plivo/rest_client.rb
|
202
|
+
- lib/plivo/template.rb
|
202
203
|
- lib/plivo/utils.rb
|
203
204
|
- lib/plivo/version.rb
|
204
205
|
- lib/plivo/xml.rb
|
205
206
|
- lib/plivo/xml/break.rb
|
206
207
|
- lib/plivo/xml/conference.rb
|
208
|
+
- lib/plivo/xml/cont.rb
|
207
209
|
- lib/plivo/xml/dial.rb
|
208
210
|
- lib/plivo/xml/dtmf.rb
|
209
211
|
- lib/plivo/xml/element.rb
|
@@ -213,6 +215,7 @@ files:
|
|
213
215
|
- lib/plivo/xml/hangup.rb
|
214
216
|
- lib/plivo/xml/lang.rb
|
215
217
|
- lib/plivo/xml/message.rb
|
218
|
+
- lib/plivo/xml/multipartycall.rb
|
216
219
|
- lib/plivo/xml/number.rb
|
217
220
|
- lib/plivo/xml/p.rb
|
218
221
|
- lib/plivo/xml/phoneme.rb
|
@@ -226,11 +229,13 @@ files:
|
|
226
229
|
- lib/plivo/xml/s.rb
|
227
230
|
- lib/plivo/xml/say_as.rb
|
228
231
|
- lib/plivo/xml/speak.rb
|
232
|
+
- lib/plivo/xml/stream.rb
|
229
233
|
- lib/plivo/xml/sub.rb
|
230
234
|
- lib/plivo/xml/user.rb
|
231
235
|
- lib/plivo/xml/w.rb
|
232
236
|
- lib/plivo/xml/wait.rb
|
233
237
|
- plivo.gemspec
|
238
|
+
- setup_sdk.sh
|
234
239
|
homepage: https://github.com/plivo/plivo-ruby
|
235
240
|
licenses:
|
236
241
|
- MIT
|