chikka 0.1.2 → 0.1.4
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/lib/chikka.rb +6 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 629b9cc2d7e40165447f7fdc4186763d5d96a9ba
|
4
|
+
data.tar.gz: 05af296d504157a668149b559bfb41c1f553c565
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 58e9dbd3760fd32bc3a72fce23741018c1f51efd3a5cf920cd23010ac9d84f20cf4ee7a51d913d6b5ede5cba79091fef40b87fde580f07b5f5a7e87529d543bc
|
7
|
+
data.tar.gz: b9a38c346220fc6e5e6c622292ea8e58a2a508b984b6969eb343e2f67d47cac3a9e7008b34ad7ca8c28d6c7ff767336c6789e808d4fd4c6581fd8a57dd85e203
|
data/lib/chikka.rb
CHANGED
@@ -51,7 +51,7 @@ module Chikka
|
|
51
51
|
|
52
52
|
def send_reply(params = {})
|
53
53
|
message_id = params.fetch(:message_id) { generate_message_id }
|
54
|
-
request_cost = params.fetch(:
|
54
|
+
request_cost = params.fetch(:request_cost) { "FREE" }
|
55
55
|
post_params = DEFAULT_PARAMS.merge({
|
56
56
|
message_type: "REPLY",
|
57
57
|
mobile_number: params[:mobile_number],
|
@@ -60,6 +60,8 @@ module Chikka
|
|
60
60
|
request_id: params[:request_id],
|
61
61
|
request_cost: request_cost
|
62
62
|
})
|
63
|
+
body = URI.encode_www_form(post_params)
|
64
|
+
parse @http.post(SMSAPI_PATH, body, {'Content-Type' => 'application/x-www-form-urlencoded'})
|
63
65
|
end
|
64
66
|
|
65
67
|
private
|
@@ -73,11 +75,11 @@ module Chikka
|
|
73
75
|
when Net::HTTPSuccess
|
74
76
|
response_obj
|
75
77
|
when Net::HTTPBadRequest
|
76
|
-
raise IncompleteParametersError.new(message=response_obj.message)
|
78
|
+
raise IncompleteParametersError.new(message="#{response_obj.message} HTTP_RESP: #{http_response}")
|
77
79
|
when Net::HTTPUnauthorized
|
78
|
-
raise AuthenticationError
|
80
|
+
raise AuthenticationError.new(message="#{response_obj.message} HTTP_RESP: #{http_response}")
|
79
81
|
else
|
80
|
-
raise Error, "Unexpected HTTP response (code=#{http_response.code})"
|
82
|
+
raise Error, "Unexpected HTTP response (code=#{http_response.code}) HTTP_RESP: #{http_response}"
|
81
83
|
end
|
82
84
|
end
|
83
85
|
end
|