gnip-client 0.1.9 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gnip/gnip-rules/rules.rb +6 -6
- data/lib/gnip/version.rb +1 -1
- 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: 5e382f081861096fa68f6bb8debb5681ce0320eb
|
4
|
+
data.tar.gz: 4bb687a49db956b891c49ba092faf4ee62c58708
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ea8d15bbf867c69574606c1ad7e0b76178bcaf116b1253b88d2b12392c16a7c878b2e59efb1a13f224a55d14c2376e9de0670401c9c3191f512be42d7232e2f4
|
7
|
+
data.tar.gz: ddbf82402cb4e7d9002a8e94692867121a79e609ce5c8f249bc7784273caf1a95bd383a9a6546a33da52b7aa13b40d31da070b9dc76b011c606f50b04710dc17
|
@@ -16,10 +16,10 @@ module Gnip
|
|
16
16
|
def add(rules)
|
17
17
|
begin
|
18
18
|
response = self.class.post(self.rules_url, basic_auth: @auth, body: rules.to_json)
|
19
|
-
if response.parsed_response["error"].present?
|
19
|
+
if response.parsed_response.present? && response.parsed_response["error"].present?
|
20
20
|
{ status: :error, code: response.response.code, error: response.parsed_response["error"]["message"] }
|
21
21
|
else
|
22
|
-
{ status: :success, code:
|
22
|
+
{ status: :success, code: 200 }
|
23
23
|
end
|
24
24
|
rescue Exception => e
|
25
25
|
{ status: :error, code: 500, error: e.message }
|
@@ -32,10 +32,10 @@ module Gnip
|
|
32
32
|
def remove(rules)
|
33
33
|
begin
|
34
34
|
response = self.class.delete(self.rules_url, basic_auth: @auth, body: rules.to_json)
|
35
|
-
if response.parsed_response["error"].present?
|
35
|
+
if response.parsed_response.present? && response.parsed_response["error"].present?
|
36
36
|
{ status: :error, code: response.response.code, error: response.parsed_response["error"]["message"] }
|
37
37
|
else
|
38
|
-
{ status: :success, code:
|
38
|
+
{ status: :success, code: 200 }
|
39
39
|
end
|
40
40
|
rescue Exception => e
|
41
41
|
{ status: :error, code: 500, error: e.message }
|
@@ -72,12 +72,12 @@ module Gnip
|
|
72
72
|
retry_times = 0
|
73
73
|
begin
|
74
74
|
rules_list = self.list
|
75
|
-
rules_list[
|
75
|
+
rules_list[:rules].in_groups_of(2, false).each do |group_of_rules|
|
76
76
|
self.remove({ "rules": group_of_rules })
|
77
77
|
end
|
78
78
|
sleep 0.05
|
79
79
|
rules_list = self.list
|
80
|
-
if !rules_list[
|
80
|
+
if !rules_list[:rules].size.zero?
|
81
81
|
self.delete_all!
|
82
82
|
else
|
83
83
|
return { status: :success, code: 200, rules: []}
|
data/lib/gnip/version.rb
CHANGED