garnet_client 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/garnet_client/result.rb +28 -0
- data/lib/garnet_client/utils/http_request.rb +2 -2
- data/lib/garnet_client/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ee9df07dc0bef137d6f76f330f5d1a46678c640
|
4
|
+
data.tar.gz: a5dab2e0cb5801d8656c789802d44a7576e52d6e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a00d08a7a563f7d16fc8ef7d366a3ba18d5e8ec8ed6cef4f7e7c9fc8a213f9cbc44cbf1d519671eeb91f927a22da79ca82368f6dbc393c175aeee7e34998fe90
|
7
|
+
data.tar.gz: 4b330c81d5627dc8bffbcae9a022f7484ead738c5eaa9eff9a2d1ff1908d0499134717e30c0414020b5c229a698e42b0f68a4d54c5db87646de6cc8f397e2931
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module GarnetClient
|
2
|
+
class Result
|
3
|
+
attr_accessor :raw, :msg
|
4
|
+
|
5
|
+
RESULT_SUCCESS_FLAG = '0'
|
6
|
+
|
7
|
+
|
8
|
+
# TX 状态
|
9
|
+
LV_TX_STATE = {
|
10
|
+
'1' => '成功',
|
11
|
+
'0' => '失败',
|
12
|
+
'2' => 'Pending'
|
13
|
+
}
|
14
|
+
|
15
|
+
def initialize(result)
|
16
|
+
self.raw = result.to_s
|
17
|
+
self.msg = result
|
18
|
+
end
|
19
|
+
|
20
|
+
def success?
|
21
|
+
@msg[0]['status']['code'] == RESULT_SUCCESS_FLAG
|
22
|
+
end
|
23
|
+
|
24
|
+
def service_msg
|
25
|
+
@msg[0]['status']['message']
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -11,7 +11,7 @@ module GarnetClient
|
|
11
11
|
api_url = "#{GarnetClient.api_base_url}/#{service_path}"
|
12
12
|
headers = GarnetClient.response_headers
|
13
13
|
|
14
|
-
response = HTTParty.post(api_url, :body =>JSON.dump(query_params), :headers => headers)
|
14
|
+
response = HTTParty.post(api_url, :body =>JSON.dump(query_params), :headers => headers, timeout: 10)
|
15
15
|
html_result = response.body
|
16
16
|
html_content = ''
|
17
17
|
|
@@ -37,7 +37,7 @@ module GarnetClient
|
|
37
37
|
api_url = "#{GarnetClient.api_base_url}/#{service_path}"
|
38
38
|
headers = GarnetClient.response_headers
|
39
39
|
|
40
|
-
response = HTTParty.get(api_url, :headers => headers)
|
40
|
+
response = HTTParty.get(api_url, :headers => headers, timeout: 10)
|
41
41
|
html_result = response.body
|
42
42
|
html_content = ''
|
43
43
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: garnet_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- tarzansos
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-08-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -87,6 +87,7 @@ files:
|
|
87
87
|
- garnet_client.gemspec
|
88
88
|
- garnet_client.rb
|
89
89
|
- lib/garnet_client.rb
|
90
|
+
- lib/garnet_client/result.rb
|
90
91
|
- lib/garnet_client/service.rb
|
91
92
|
- lib/garnet_client/utils/http_request.rb
|
92
93
|
- lib/garnet_client/version.rb
|