Fixups not worth sending back to review

Stephen Paul Weber created

Change summary

bin/notify_inbound_failures_job | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)

Detailed changes

bin/notify_inbound_failures_job 🔗

@@ -45,7 +45,7 @@ class BlockedMessage
 
 	def notification_text
 		"This is an automated notification from JMP " \
-		"letting you know that a message from #{@msg['sourceTn']} " \
+		"letting you know that a message to you " \
 		"was blocked by the carrier or otherwise failed " \
 		"to be delivered at #{@msg['receiveTime']}."
 	end
@@ -64,12 +64,12 @@ class BlockedMessage
 	end
 
 	def to_h
-		[{
+		{
 			time: @msg["receiveTime"],
 			type: "sms",
 			description: "Notification of failed or blocked message",
 			message: notification_body
-		}].to_json
+		}
 	end
 
 	def notify!
@@ -77,7 +77,7 @@ class BlockedMessage
 			OPTIONS[:webhook_endpoint],
 			tls: {verify_peer: true}
 		).post(
-			body: to_h,
+			body: [to_h].to_json,
 			head: {"Content-Type"=>"application/json"}
 		)
 	end
@@ -112,11 +112,10 @@ class BandwidthMessages
 		"/messages"
 
 	def req
-		req = EM::HttpRequest.new(URL, tls: {verify_peer: true})
-		req.use(EM::Middleware::JSONResponse).get(
-			head: BW_HEAD,
-			query: @query
-		)
+		EM::HttpRequest
+			.new(URL, tls: {verify_peer: true})
+			.use(EM::Middleware::JSONResponse)
+			.get(head: BW_HEAD, query: @query)
 	end
 
 	def for_next_page(res)
@@ -159,7 +158,6 @@ EM.run do
 	EMPromise.resolve(
 		redis.mget("bw_last_msg_failed_date", "bw_last_msg_failed_id")
 	).then { |(last_msg_date, last_msg_id)|
-		## Full disclosure, string format came from ChatGPT
 		thirty_mins_ago = (Time.now - 30 * 60).strftime("%Y-%m-%dT%H:%M:%S.%LZ")
 		last_msg_date ||= thirty_mins_ago
 		last_msg_date = [last_msg_date, thirty_mins_ago].max