gnip-client 0.2.1 → 0.2.2

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: 1fcc97381efe8a058ea475eacce4761459395222
4
- data.tar.gz: c32e9e5c5f58ffabe772a044f17a0cd860a1dfaa
3
+ metadata.gz: 7823da744cc5f7813dc5d7ae1189a3f5ef4f46a5
4
+ data.tar.gz: aa5ffac45a636bfcc599812e4d0d7305bd888a50
5
5
  SHA512:
6
- metadata.gz: 345247b270e0c8c96e02384b3aa63bee886f71b26fc0862bf458c83aeec4f4df69f42dbe18d791e59b1fca8764e3bf60c5e83c0e4d8c036dd40c0bb0ec87373b
7
- data.tar.gz: 1ab8fee38c9a2cfec61dac060cf4c6ece3030de3eaf350253f92b27d9640c2d95e73c7aa37d689703e5ad301ff82382faa087a345e1434cd44c3560f0cc01d52
6
+ metadata.gz: 6d6f31dd21ddd20f4df463ef236ce4a390e876363b2e821fb32bf83f251a8b91b86704bb7b3f32bfcba1a9a160717bbdc584952bef03875a669de62da4faa61e
7
+ data.tar.gz: 77055fa6b3ad251bf514c918ddfb60e73f1e11bc8307e5a65c7ff772c87c52cfc178c69d543ca989d2465b8d7a3159c2bf08e10e67d0ca360ab53a5b8f35aee5
@@ -31,11 +31,14 @@ module Gnip
31
31
  search_options[:next] = options[:next_cursor] if options[:next_cursor]
32
32
  url = [self.search_url, search_options.to_query].join('?')
33
33
  begin
34
- parsed_response = self.class.get(url, basic_auth: @auth).parsed_response
35
- if parsed_response["error"].present?
36
- response = { results: [], next: nil, error: parsed_response["error"]["message"] }
34
+ gnip_call = self.class.get(url, basic_auth: @auth)
35
+ parsed_response = gnip_call.parsed_response
36
+ parsed_response = (parsed_response||{}).with_indifferent_access
37
+ raise gnip_call.response.message if !parsed_response.present?
38
+ if parsed_response[:error].present?
39
+ response = { results: [], next: nil, error: parsed_response[:error][:message] }
37
40
  else
38
- response = { results: parsed_response["results"], next: parsed_response["next"] }
41
+ response = { results: parsed_response[:results], next: parsed_response[:next] }
39
42
  end
40
43
  rescue Exception => e
41
44
  response = { results: [], next: nil, error: e.message }
@@ -57,8 +60,10 @@ module Gnip
57
60
  url = [self.counts_url, search_options.to_query].join('?')
58
61
 
59
62
  begin
60
- parsed_response = self.class.get(url, basic_auth: @auth).parsed_response
61
- parsed_response = parsed_response.with_indifferent_access
63
+ gnip_call = self.class.get(url, basic_auth: @auth)
64
+ parsed_response = gnip_call.parsed_response
65
+ parsed_response = (parsed_response||{}).with_indifferent_access
66
+ raise gnip_call.response.message if !parsed_response.present?
62
67
  if parsed_response[:error].present?
63
68
  response = { results: [], next: nil, error: parsed_response[:error][:message] }
64
69
  else
@@ -1,3 +1,3 @@
1
1
  module Gnip
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
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.1
4
+ version: 0.2.2
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-11 00:00:00.000000000 Z
11
+ date: 2015-11-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -162,4 +162,3 @@ specification_version: 4
162
162
  summary: A Ruby library for accessing the Gnip API. See https://gnip.com/ for full
163
163
  details and to sign up for an account.
164
164
  test_files: []
165
- has_rdoc: