gnip-client 0.2.0 → 0.2.1

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: 5e382f081861096fa68f6bb8debb5681ce0320eb
4
- data.tar.gz: 4bb687a49db956b891c49ba092faf4ee62c58708
3
+ metadata.gz: 1fcc97381efe8a058ea475eacce4761459395222
4
+ data.tar.gz: c32e9e5c5f58ffabe772a044f17a0cd860a1dfaa
5
5
  SHA512:
6
- metadata.gz: ea8d15bbf867c69574606c1ad7e0b76178bcaf116b1253b88d2b12392c16a7c878b2e59efb1a13f224a55d14c2376e9de0670401c9c3191f512be42d7232e2f4
7
- data.tar.gz: ddbf82402cb4e7d9002a8e94692867121a79e609ce5c8f249bc7784273caf1a95bd383a9a6546a33da52b7aa13b40d31da070b9dc76b011c606f50b04710dc17
6
+ metadata.gz: 345247b270e0c8c96e02384b3aa63bee886f71b26fc0862bf458c83aeec4f4df69f42dbe18d791e59b1fca8764e3bf60c5e83c0e4d8c036dd40c0bb0ec87373b
7
+ data.tar.gz: 1ab8fee38c9a2cfec61dac060cf4c6ece3030de3eaf350253f92b27d9640c2d95e73c7aa37d689703e5ad301ff82382faa087a345e1434cd44c3560f0cc01d52
@@ -47,7 +47,11 @@ module Gnip
47
47
  def list
48
48
  begin
49
49
  response = self.class.get(self.rules_url, basic_auth: @auth)
50
- { rules: response.parsed_response["rules"], status: :success, code: response.response.code }
50
+ if response.parsed_response.present? && response.parsed_response["error"].present?
51
+ { status: :error, code: response.response.code, error: response.parsed_response["error"]["message"] }
52
+ else
53
+ { status: :success, code: 200, rules: response.parsed_response["rules"] }
54
+ end
51
55
  rescue Exception => e
52
56
  { status: :error, code: 500, error: e.message }
53
57
  end
@@ -56,9 +60,13 @@ module Gnip
56
60
  #Get the full list of rules by tag
57
61
  def list_by_tag(tag)
58
62
  begin
59
- response = self.class.get(self.rules_url, basic_auth: @auth)
60
- rules = response.parsed_response["rules"]
61
- return { rules: rules.select{|rule| rule["tag"] == tag} }.merge({ status: :success, code: response.response.code })
63
+ response = self.class.get(self.rules_url, basic_auth: @auth)
64
+ if response.parsed_response.present? && response.parsed_response["error"].present?
65
+ { status: :error, code: response.response.code, error: response.parsed_response["error"]["message"] }
66
+ else
67
+ rules = response.parsed_response["rules"]
68
+ { status: :success, code: 200, rules: rules.select{ |rule| rule["tag"] == tag } }
69
+ end
62
70
  rescue Exception => e
63
71
  { status: :error, code: 500, error: e.message }
64
72
  end
@@ -1,3 +1,3 @@
1
1
  module Gnip
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gnip-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Duccio Giovannelli
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-08-07 00:00:00.000000000 Z
11
+ date: 2015-08-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler