evostream-event 0.2.5.pre.34 → 0.2.5.pre.35
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/evostream/event.rb +10 -2
- 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: e4baa9af53940d34633e420d681b329609517ac3
|
4
|
+
data.tar.gz: a574bc56a10e985fcf44f2cba7225dde3c97ccc8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3a9f496ca7e709c84d2b6b510d929be6a3078c3bb480baec37826dd3810e5b83b60ae72a2d381ade34ccb9bc09a41d56b152b07675fff6a37efafe69a5cd83e3
|
7
|
+
data.tar.gz: b57aa429ca4f3e6f94a8dfdae3144680e75899a8d2286598d0b8ba8e0fdd432d82d92018183f68d24096cb6f2545bde80737e2e40e0ddd34db6c8463c5716129
|
data/lib/evostream/event.rb
CHANGED
@@ -7,11 +7,13 @@ require 'evostream/event/commands'
|
|
7
7
|
require 'evostream/event/events'
|
8
8
|
require 'net/http'
|
9
9
|
|
10
|
+
# :reek:DuplicateMethod
|
11
|
+
|
10
12
|
# Primary command to gem
|
11
13
|
module Evostream
|
12
14
|
def self.send_command(cmd)
|
13
15
|
response = prepare_request(cmd)
|
14
|
-
body = JSON.parse(response.body).to_hash
|
16
|
+
body = response.body.nil? ? {} : JSON.parse(response.body).to_hash
|
15
17
|
{ status: Evostream.status(body), message: body['description'] }
|
16
18
|
end
|
17
19
|
|
@@ -31,7 +33,13 @@ module Evostream
|
|
31
33
|
end
|
32
34
|
|
33
35
|
def self.status(body)
|
34
|
-
body['status'].eql?('FAIL')
|
36
|
+
if body['status'].eql?('FAIL')
|
37
|
+
403
|
38
|
+
elsif body.empty?
|
39
|
+
204
|
40
|
+
else
|
41
|
+
200
|
42
|
+
end
|
35
43
|
end
|
36
44
|
|
37
45
|
def self.prepare_request(cmd)
|