mock-twilio 0.6.0 → 0.7.1
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 51717583a9857a368836f3a2041841fda565c5d7a721d45b28aa2eda5e367d9c
|
4
|
+
data.tar.gz: cf41c7ca02040ba3769f45f69942444d1b2f847ec8424fccb01e2b26c2f92377
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fdf89c97119f3060b929909865daf3feab4292dcb760942e2186cd2008d659f70388e0a7c22cd105f43e3936f3f67e7ec8281a228d2167e99e07b5118517b077
|
7
|
+
data.tar.gz: 123fa800f3c9681e8fe405d0c5c70a4129c899f6325cf2fa64b2c5f99b3cc82bdc65e41b8b10c3b3132bec2a4e9ce6c40930306c43c235d875bc607faf66f509
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,10 @@
|
|
1
|
-
## [0.
|
1
|
+
## [0.7.1] - 2024-07-09
|
2
|
+
- Override Twilio Messaging PhoneNumberList Limit
|
3
|
+
|
4
|
+
## [0.7.0] - 2024-07-09
|
5
|
+
- Support MessagingServicesV1 phone_numbers
|
6
|
+
|
7
|
+
## [0.6.0] - 2024-07-02
|
2
8
|
- Upgrade twilio-ruby 7.1.0
|
3
9
|
|
4
10
|
## [0.4.0] - 2024-07-01
|
@@ -5,16 +5,34 @@ module Mock
|
|
5
5
|
module Schemas
|
6
6
|
class MessagingV1
|
7
7
|
class << self
|
8
|
-
def
|
8
|
+
def for(body, request)
|
9
|
+
phone_number_sid(body) if body["phone_numbers"].first["sid"]
|
10
|
+
body["phone_numbers"].first["account_sid"] = ::Twilio.account_sid if body["phone_numbers"].first["account_sid"]
|
11
|
+
parse_messaging_service_sid(body, request) if body["phone_numbers"].first["service_sid"]
|
12
|
+
body["phone_numbers"].first["phone_number"] = "987654321" if body["phone_numbers"].first["phone_number"]
|
13
|
+
body["phone_numbers"].first["country_code"] = "US" if body["phone_numbers"].first["country_code"]
|
14
|
+
|
9
15
|
# Params for twilio pagination, needed for twilio-ruby serializers and absolute paths
|
10
|
-
body["meta"]["key"] = "phone_numbers" if body["meta"]
|
11
|
-
body["meta"]["page_size"] = 20 if body["meta"]
|
12
|
-
body["meta"]["first_page_url"] = "https://messaging.twilio.com/v1/Services/MGFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF/PhoneNumbers?PageSize=20&Page=0" if body["meta"]
|
13
|
-
body["meta"]["previous_page_url"] = "https://messaging.twilio.com/v1/Services/MGFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF/PhoneNumbers?PageSize=20&Page=0" if body["meta"]
|
14
|
-
body["meta"]["next_page_url"] = "https://messaging.twilio.com/v1/Services/MGFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF/PhoneNumbers?PageSize=20&Page=1" if body["meta"]
|
15
|
-
body["meta"]["url"] = "https://messaging.twilio.com/v1/Services/MGFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF/PhoneNumbers?PageSize=20&Page=0" if body["meta"]
|
16
|
+
body["meta"]["key"] = "phone_numbers" if body["meta"]["key"]
|
17
|
+
body["meta"]["page_size"] = 20 if body["meta"]["page_size"]
|
18
|
+
body["meta"]["first_page_url"] = "https://messaging.twilio.com/v1/Services/MGFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF/PhoneNumbers?PageSize=20&Page=0" if body["meta"]["first_page_url"]
|
19
|
+
body["meta"]["previous_page_url"] = "https://messaging.twilio.com/v1/Services/MGFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF/PhoneNumbers?PageSize=20&Page=0" if body["meta"]["previous_page_url"]
|
20
|
+
body["meta"]["next_page_url"] = "https://messaging.twilio.com/v1/Services/MGFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF/PhoneNumbers?PageSize=20&Page=1" if body["meta"]["next_page_url"]
|
21
|
+
body["meta"]["url"] = "https://messaging.twilio.com/v1/Services/MGFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF/PhoneNumbers?PageSize=20&Page=0" if body["meta"]["url"]
|
16
22
|
body
|
17
23
|
end
|
24
|
+
|
25
|
+
def phone_number_sid(body)
|
26
|
+
prefix = "PN"
|
27
|
+
sid = prefix + SecureRandom.hex(16)
|
28
|
+
body["phone_numbers"].first["sid"] = sid
|
29
|
+
end
|
30
|
+
|
31
|
+
def parse_messaging_service_sid(body, request)
|
32
|
+
uri = URI(request.url)
|
33
|
+
messaging_service_sid = uri.path.split('/')[3]
|
34
|
+
body["phone_numbers"].first["service_sid"] = messaging_service_sid
|
35
|
+
end
|
18
36
|
end
|
19
37
|
end
|
20
38
|
end
|
data/lib/mock/twilio/version.rb
CHANGED
data/lib/mock/twilio.rb
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
require "rufus-scheduler"
|
4
4
|
require "active_support"
|
5
5
|
require "active_support/core_ext/time"
|
6
|
+
require "twilio-ruby"
|
6
7
|
require_relative "twilio/middleware/proxy"
|
7
8
|
require_relative "twilio/webhook_client"
|
8
9
|
require_relative "twilio/webhooks/base"
|
@@ -16,6 +17,7 @@ require_relative "twilio/client"
|
|
16
17
|
require_relative "twilio/decorator"
|
17
18
|
require_relative "twilio/response"
|
18
19
|
require_relative "twilio/version"
|
20
|
+
require_relative "../twilio/rest/messaging/v1/service/phone_number_decorator"
|
19
21
|
|
20
22
|
module Mock
|
21
23
|
module Twilio
|
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: 0.
|
4
|
+
version: 0.7.1
|
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-07-
|
11
|
+
date: 2024-07-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -105,6 +105,7 @@ files:
|
|
105
105
|
- lib/mock/twilio/webhooks/conferences.rb
|
106
106
|
- lib/mock/twilio/webhooks/customer_profiles.rb
|
107
107
|
- lib/mock/twilio/webhooks/messages.rb
|
108
|
+
- lib/twilio/rest/messaging/v1/service/phone_number_decorator.rb
|
108
109
|
- sig/mock/twilio.rbs
|
109
110
|
homepage: https://github.com/schoolstatus/mock-twilio
|
110
111
|
licenses:
|