Change summary
bin/notify_inbound_failures_job | 8 ++++----
bin/view-events | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
Detailed changes
@@ -74,7 +74,7 @@ class BlockedMessage
def notify!
EM::HttpRequest.new(
- OPTIONS[:webhook_endpoint],
+ URI(OPTIONS[:webhook_endpoint]),
tls: {verify_peer: true}
).post(
body: [to_h].to_json,
@@ -99,6 +99,8 @@ class BandwidthMessages
def each(&block)
req.then { |res|
+ puts "Found #{res.response["messages"].length} blocked messages"
+
EMPromise.all(res.response["messages"].map { |msg|
block.call(BlockedMessage.new(msg))
}).then { res }
@@ -107,9 +109,7 @@ class BandwidthMessages
}
end
- URL = "https://messaging.bandwidth.com/api/v2/users/" \
- "#{OPTIONS[:account_id]}" \
- "/messages"
+ URL = URI("https://messaging.bandwidth.com/api/v2/users/#{OPTIONS[:account_id]}/messages")
def req
EM::HttpRequest
@@ -68,7 +68,7 @@ def to_stream_id(str)
"#{epoch * 1000}-0"
end
-def format_event(fields, json: False, **)
+def format_event(fields, json: false, **)
return JSON.dump(fields) if json
event = fields["event"]