chikka 0.1.5 → 0.1.6
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 +7 -6
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a8a5f1029af96d608c55ce09d27f7db62b1af06
|
4
|
+
data.tar.gz: 51f76b13e1c2a9c6e28d5e23b295a843ef4219c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 260cc6a0da2e78b0b3d2490d9f5792a705bf26066755cbff31ce14d707cc67e3098e2221d4e03de9f33fcd215bc58ba023309dd5f42ea9717abfcdb1b38d54c3
|
7
|
+
data.tar.gz: c21407721d6393066137bb3c35977341cc4b8bbb3af9d628633327a6bd5e1f63dde254b1641c8dec9649261bff2a49cd00a5e87940c29f6dbdd40baad19b4eed
|
data/lib/chikka.rb
CHANGED
@@ -11,12 +11,13 @@ module Chikka
|
|
11
11
|
class AuthenticationError < Error; end
|
12
12
|
|
13
13
|
class Response
|
14
|
-
attr_reader :status, :message, :description
|
15
|
-
def initialize(http_response)
|
14
|
+
attr_reader :status, :message, :description, :message_id
|
15
|
+
def initialize(http_response, message_id)
|
16
16
|
r = JSON.parse(http_response.body)
|
17
17
|
@status = r['status']
|
18
18
|
@message = r['message']
|
19
19
|
@description = r['description']
|
20
|
+
@message_id = message_id
|
20
21
|
end
|
21
22
|
end
|
22
23
|
|
@@ -47,7 +48,7 @@ module Chikka
|
|
47
48
|
message_id: message_id
|
48
49
|
})
|
49
50
|
body = URI.encode_www_form(post_params)
|
50
|
-
parse
|
51
|
+
parse(@http.post(SMSAPI_PATH, body, {'Content-Type' => 'application/x-www-form-urlencoded'}), message_id)
|
51
52
|
end
|
52
53
|
|
53
54
|
def send_reply(params = {})
|
@@ -62,7 +63,7 @@ module Chikka
|
|
62
63
|
request_cost: request_cost
|
63
64
|
})
|
64
65
|
body = URI.encode_www_form(post_params)
|
65
|
-
parse
|
66
|
+
parse(@http.post(SMSAPI_PATH, body, {'Content-Type' => 'application/x-www-form-urlencoded'}), message_id)
|
66
67
|
end
|
67
68
|
|
68
69
|
private
|
@@ -70,8 +71,8 @@ module Chikka
|
|
70
71
|
SecureRandom.hex
|
71
72
|
end
|
72
73
|
|
73
|
-
def parse(http_response)
|
74
|
-
response_obj = Response.new(http_response)
|
74
|
+
def parse(http_response, message_id)
|
75
|
+
response_obj = Response.new(http_response, message_id)
|
75
76
|
case response_obj.status
|
76
77
|
when 200
|
77
78
|
response_obj
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chikka
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrei Navarro
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|