lib/pwush/client.rb in pwush-0.1.2 vs lib/pwush/client.rb in pwush-0.1.3
- old
+ new
@@ -5,11 +5,11 @@
def initialize(options)
@config = Config.new(options)
end
def create_message(*messages)
- post(:createMessage, notifications: messages)
+ post(:createMessage, notifications: messages.flatten)
end
alias push create_message
def message_details(message)
post(:getMessageDetails, message: message)
@@ -48,10 +48,17 @@
def perform_request(verb, action, payload)
Response.wrap { raw_request(verb, action, payload) }
end
def raw_request(verb, action, payload)
- Http.request(verb, url(action), json: build_request(payload).body)
+ request = build_request(payload)
+ url = url(action)
+
+ @config.logger.info(
+ "Pushwoosh #{verb.upcase} #{url} BODY #{request.body.to_json}"
+ )
+
+ Http.request(verb, url, json: request.body)
end
def build_request(payload = nil)
Request.new(auth: @config.auth, app: @config.app, payload: payload)
end