mock-twilio 1.0.0 → 1.1.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '0288825792a2120cef9986fac4b2b0d862870f8684494d6e5cd5ff56118e2df4'
|
4
|
+
data.tar.gz: 114f34bac6342aaacaec7717e8b4dbd167534dbaa2256f295280fb689b2bcb40
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3b28d6052491c9fe19af3239b06472b8d2ca31e519f3ea18df82ce506f723fe4a9d4de70f59a6e963052b1c13f3bb12a08362aef4bd38340f9c3919c9543be9e
|
7
|
+
data.tar.gz: f6de2b86dd622fa70f2df6825a39a1a2bb06090e34bbf1ae6888f1deb7c4bb64ba7f8e78ce43a011eec806ca59f9b68983195777e7f94f9ab50cdaae4a49efa2
|
data/CHANGELOG.md
CHANGED
@@ -30,15 +30,17 @@ module Mock
|
|
30
30
|
scheduler.in '2s' do
|
31
31
|
conference_uuid = request.data["Url"].split("conference_uuid=").last
|
32
32
|
begin
|
33
|
-
response = Mock::Twilio::Webhooks::CallStatusUpdates.trigger(sid, conference_uuid)
|
33
|
+
response = Mock::Twilio::Webhooks::CallStatusUpdates.trigger(sid, conference_uuid, 'unknown')
|
34
34
|
|
35
|
-
conference_response = if response.
|
35
|
+
conference_response = if response.success?
|
36
36
|
twiMl_xml = Nokogiri::XML response.body
|
37
37
|
friendly_name = twiMl_xml.at_xpath('//Dial').at_xpath('//Conference').children.text
|
38
38
|
Mock::Twilio::Webhooks::Conferences.trigger(friendly_name)
|
39
39
|
end
|
40
40
|
|
41
|
-
Mock::Twilio::Webhooks::Calls.trigger(sid) if conference_response.
|
41
|
+
participant_response = Mock::Twilio::Webhooks::Calls.trigger(sid) if conference_response.success?
|
42
|
+
|
43
|
+
Mock::Twilio::Webhooks::CallStatusUpdates.trigger(sid, conference_uuid, 'machine_start') if participant_response.success?
|
42
44
|
rescue => e
|
43
45
|
puts e
|
44
46
|
end
|
data/lib/mock/twilio/version.rb
CHANGED
@@ -6,13 +6,13 @@ module Mock
|
|
6
6
|
class CallStatusUpdates < Base
|
7
7
|
URL = "/api/v1/twilio_calls/voice_responses"
|
8
8
|
|
9
|
-
def self.trigger(sid, conference_uuid)
|
9
|
+
def self.trigger(sid, conference_uuid, answered_by)
|
10
10
|
# Wait simulation from twilio
|
11
11
|
sleep DELAY.sample
|
12
12
|
|
13
13
|
request_url = Mock::Twilio.proto + "://" + Mock::Twilio.forwarded_host + URL
|
14
14
|
|
15
|
-
data = call_status_updates_data(sid, conference_uuid)
|
15
|
+
data = call_status_updates_data(sid, conference_uuid, answered_by)
|
16
16
|
|
17
17
|
signature = build_signature_for_request(request_url, data)
|
18
18
|
|
@@ -33,7 +33,7 @@ module Mock
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
-
def self.call_status_updates_data(sid, conference_uuid)
|
36
|
+
def self.call_status_updates_data(sid, conference_uuid, answered_by)
|
37
37
|
{
|
38
38
|
:AccountSid=> twilio_client.account_sid,
|
39
39
|
:ApiVersion=> "2010-04-01",
|
@@ -68,7 +68,7 @@ module Mock
|
|
68
68
|
:ToZip=> "33605",
|
69
69
|
:StirStatus=> "B",
|
70
70
|
:StirVerstat=> "TN-Validation-Passed-B",
|
71
|
-
:AnsweredBy=>
|
71
|
+
:AnsweredBy=> answered_by,
|
72
72
|
:conference_uuid=> conference_uuid
|
73
73
|
}
|
74
74
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mock-twilio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- SchoolStatus Platform Team
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-08-
|
11
|
+
date: 2024-08-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|