mock-bandwidth 1.1.1 → 1.2.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 +4 -4
- data/CHANGELOG.md +7 -0
- data/README.md +2 -0
- data/lib/mock/bandwidth/decorators/messaging_v2/message_create.rb +3 -2
- data/lib/mock/bandwidth/util/configuration.rb +5 -1
- data/lib/mock/bandwidth/version.rb +1 -1
- data/lib/mock/bandwidth/webhooks/messages.rb +3 -1
- data/lib/mock/bandwidth.rb +2 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f8655a3058743a8d413830fb6186354de556912c78410fc4e17242e13a7372c
|
4
|
+
data.tar.gz: 6e6574ae2b30987fed7e198bbc649af629784642c55256d13a2d84bfbcb5d37c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eeb5ee97dfb5103cfce82d68679a12a0936346aac7a4e8e457312f9900d5572637b7825b469d977c5d5b029ce97fd8c5f11577bcc6318f877fd2cafb247504b7
|
7
|
+
data.tar.gz: 8124f49d1abd0b3ae0679ce9ae582e640ae2934374c411f4a8c79f0abe56887e4e1fdb650f351d38d04e219b8cdcc941bf01a50b9b8ae52dd444dada6a8382ae
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -6,6 +6,8 @@ module Mock
|
|
6
6
|
module MessagingV2
|
7
7
|
class MessageCreate
|
8
8
|
class << self
|
9
|
+
@@scheduler = Rufus::Scheduler.new
|
10
|
+
|
9
11
|
def decorate(body, request)
|
10
12
|
data = JSON.parse request.request_body
|
11
13
|
|
@@ -24,8 +26,7 @@ module Mock
|
|
24
26
|
timestamp = (Time.now.to_f * 1000).to_i.to_s[0..12]
|
25
27
|
random_part = SecureRandom.alphanumeric(15).downcase
|
26
28
|
id = "#{timestamp}#{random_part}"
|
27
|
-
scheduler
|
28
|
-
scheduler.in '2s' do
|
29
|
+
@@scheduler.in '2s' do
|
29
30
|
begin
|
30
31
|
Mock::Bandwidth::Webhooks::Messages.trigger(id, body)
|
31
32
|
rescue => e
|
@@ -4,11 +4,15 @@ module Mock
|
|
4
4
|
module Bandwidth
|
5
5
|
module Util
|
6
6
|
class Configuration
|
7
|
-
attr_accessor :webhook_message_status_url
|
7
|
+
attr_accessor :webhook_message_status_url, :disable_webhooks
|
8
8
|
|
9
9
|
def webhook_message_status_url=(value)
|
10
10
|
@webhook_message_status_url = value
|
11
11
|
end
|
12
|
+
|
13
|
+
def disable_webhooks=(value)
|
14
|
+
@disable_webhooks = value
|
15
|
+
end
|
12
16
|
end
|
13
17
|
end
|
14
18
|
end
|
@@ -5,6 +5,8 @@ module Mock
|
|
5
5
|
module Webhooks
|
6
6
|
class Messages < Base
|
7
7
|
def self.trigger(id, body)
|
8
|
+
return if Mock::Bandwidth.disable_webhooks
|
9
|
+
|
8
10
|
# Wait simulation from twilio
|
9
11
|
sleep DELAY.sample
|
10
12
|
|
@@ -41,7 +43,7 @@ module Mock
|
|
41
43
|
when 200..204
|
42
44
|
response
|
43
45
|
when 400..600
|
44
|
-
raise Webhooks::RestError, Mock::
|
46
|
+
raise Webhooks::RestError, Mock::Bandwidth::ErrorHandler.new(response).raise
|
45
47
|
end
|
46
48
|
end
|
47
49
|
end
|
data/lib/mock/bandwidth.rb
CHANGED
@@ -18,7 +18,7 @@ module Mock
|
|
18
18
|
module Bandwidth
|
19
19
|
extend SingleForwardable
|
20
20
|
|
21
|
-
def_delegators :configuration, :webhook_message_status_url
|
21
|
+
def_delegators :configuration, :webhook_message_status_url, :disable_webhooks
|
22
22
|
|
23
23
|
def self.configure(&block)
|
24
24
|
yield configuration
|
@@ -28,6 +28,6 @@ module Mock
|
|
28
28
|
@configuration ||= Util::Configuration.new
|
29
29
|
end
|
30
30
|
|
31
|
-
|
31
|
+
public_class_method :configuration
|
32
32
|
end
|
33
33
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mock-bandwidth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.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: 2025-02-
|
11
|
+
date: 2025-02-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -132,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
132
132
|
- !ruby/object:Gem::Version
|
133
133
|
version: '0'
|
134
134
|
requirements: []
|
135
|
-
rubygems_version: 3.
|
135
|
+
rubygems_version: 3.5.12
|
136
136
|
signing_key:
|
137
137
|
specification_version: 4
|
138
138
|
summary: This repository contains Mock::Bandwidth and Webhooks for Bandwidth's API.
|