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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2bd291d08b369112aae24ad7de832c69509e6e1a
4
- data.tar.gz: 415fb652ecee7f4e5f267d6ce839336168131a2f
3
+ metadata.gz: 2ee9df07dc0bef137d6f76f330f5d1a46678c640
4
+ data.tar.gz: a5dab2e0cb5801d8656c789802d44a7576e52d6e
5
5
  SHA512:
6
- metadata.gz: 08fd93b3861be24225ce49868d5649c27d3b575c004e6ac8c96d11fc8df008916204ed363b57ac2679a5db000b7b9f5faa04f22d19e86f284e027d3ef4247e43
7
- data.tar.gz: 719802f12788e9b59ce88959faef11bce5f361387ed5083cc5bdadf055dffca2c076a8476fb36d40d77c752768d1d766ad11bc3d62a1dfb9d4b5f8f5689058f9
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
 
@@ -1,3 +1,3 @@
1
1
  module GarnetClient
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
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.2
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-07-31 00:00:00.000000000 Z
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