Skip to content

Commit 3f5015a

Browse files
committed
ActiveSupport notification
1 parent 69c4ed7 commit 3f5015a

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

lib/smbglobal_sms/request.rb

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# encoding: utf-8
22
require 'faraday'
3+
require "active_support/notifications"
34

45
require_relative 'response'
56
require_relative 'error'
@@ -49,12 +50,17 @@ def send_sms(id, message, recipients, sender="Jobline")
4950
private
5051

5152
def response_body(id, message, recipients, sender)
53+
msg = string_to_hex(message)
54+
query_string = "transactionid=#{id}&username=#{username}&password=#{password}&sender=#{sender}&binary=#{msg}&recp=#{recipients}"
55+
56+
ActiveSupport::Notifications.instrument(:sms_request, query_string: query_string)
57+
5258
@connection.post(endpoint, {
5359
transactionid: id,
5460
username: username,
5561
password: password,
5662
sender: sender,
57-
binary: string_to_hex(message),
63+
binary: msg,
5864
recp: recipients}).body
5965
end
6066

smbglobal-sms.gemspec

+1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Gem::Specification.new do |gem|
1818
gem.add_dependency "faraday", "0.8.1"
1919
gem.add_dependency "nokogiri", "~> 1.5"
2020
gem.add_dependency "uuid", "2.3.5"
21+
gem.add_dependency "activesupport"
2122
gem.add_development_dependency "rake"
2223
gem.add_development_dependency "rspec", "~> 2.11"
2324
gem.add_development_dependency "yard"

0 commit comments

Comments
 (0)