mock-twilio 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1da1ec05dd743344d3013c3f39a42923a3169f1712f5888379d404d29c437f0f
4
- data.tar.gz: 59529b53405a1ea90813af0d41174a98a197a19c05b1b38968883e98fb7c8284
3
+ metadata.gz: '0288825792a2120cef9986fac4b2b0d862870f8684494d6e5cd5ff56118e2df4'
4
+ data.tar.gz: 114f34bac6342aaacaec7717e8b4dbd167534dbaa2256f295280fb689b2bcb40
5
5
  SHA512:
6
- metadata.gz: 5663f1c128513d140c75d2505c85e1e77c71c226889d1aa3a230df2764f7d4010964f2781c895508c5a2eb3df2d60225aa7f74e64df1c3d0e6583e5fff4e8659
7
- data.tar.gz: 07ef35f9b4ee075fb4af82ffb03e02b5e6bb4af1dc9d324c9a0c4de7590a4c29314c58933798ab53bc0bd3859bdec6410c6d506eb03171207381b343467b90ac
6
+ metadata.gz: 3b28d6052491c9fe19af3239b06472b8d2ca31e519f3ea18df82ce506f723fe4a9d4de70f59a6e963052b1c13f3bb12a08362aef4bd38340f9c3919c9543be9e
7
+ data.tar.gz: f6de2b86dd622fa70f2df6825a39a1a2bb06090e34bbf1ae6888f1deb7c4bb64ba7f8e78ce43a011eec806ca59f9b68983195777e7f94f9ab50cdaae4a49efa2
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## [1.1.0] - 2024-08-08
2
+ - Add conference call no-answer use case webhooks flow
3
+
1
4
  ## [1.0.0] - 2024-08-06
2
5
  - Support Webhooks::InboundMessages
3
6
 
@@ -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.status == 200
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.status == 200
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
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Mock
4
4
  module Twilio
5
- VERSION = "1.0.0"
5
+ VERSION = "1.1.0"
6
6
  end
7
7
  end
@@ -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=> "unknown",
71
+ :AnsweredBy=> answered_by,
72
72
  :conference_uuid=> conference_uuid
73
73
  }
74
74
  end
@@ -50,7 +50,7 @@ module Mock
50
50
  :CallerState=> "CA",
51
51
  :CallerZip=> "no value",
52
52
  :CallSid=> sid,
53
- :CallStatus=> "in-progress",
53
+ :CallStatus=> "ringing",
54
54
  :Direction=> "outbound-api",
55
55
  :Duration=> "0",
56
56
  :From=> "+18111111111",
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.0.0
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-05 00:00:00.000000000 Z
11
+ date: 2024-08-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday