chimps 0.3.5 → 0.3.6
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/chimps/config.rb +1 -1
- data/lib/chimps/query_request.rb +1 -1
- data/lib/chimps/request.rb +2 -2
- data/lib/chimps/response.rb +1 -1
- data/spec/chimps/request_spec.rb +1 -1
- metadata +6 -8
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.3.
|
1
|
+
0.3.6
|
data/lib/chimps/config.rb
CHANGED
data/lib/chimps/query_request.rb
CHANGED
data/lib/chimps/request.rb
CHANGED
@@ -102,7 +102,7 @@ module Chimps
|
|
102
102
|
#
|
103
103
|
# @return [true, false]
|
104
104
|
def authenticable?
|
105
|
-
|
105
|
+
Chimps.config[:catalog][:key] && Chimps.config[:catalog][:secret]
|
106
106
|
end
|
107
107
|
alias_method :signable?, :authenticable?
|
108
108
|
|
@@ -261,7 +261,7 @@ module Chimps
|
|
261
261
|
# @return [String]
|
262
262
|
def signed_query_string
|
263
263
|
return unsigned_query_string unless should_encode?
|
264
|
-
text_to_sign = ((body == true || (! body.
|
264
|
+
text_to_sign = ((body == true || (! body.empty?)) ? encoded_body : unsigned_query_string_stripped)
|
265
265
|
signature = sign(text_to_sign)
|
266
266
|
"#{unsigned_query_string}&signature=#{signature}"
|
267
267
|
end
|
data/lib/chimps/response.rb
CHANGED
@@ -162,7 +162,7 @@ module Chimps
|
|
162
162
|
#
|
163
163
|
# @return [Hash, Array, String]
|
164
164
|
def parse_response_body
|
165
|
-
return {} if body.
|
165
|
+
return {} if body.nil? || body.empty? || body == 'null'
|
166
166
|
if content_type == :yaml
|
167
167
|
begin
|
168
168
|
YAML.load(StringIO.new(body))
|
data/spec/chimps/request_spec.rb
CHANGED
@@ -54,7 +54,7 @@ describe Chimps::Request do
|
|
54
54
|
|
55
55
|
describe "generating the request body" do
|
56
56
|
it "should have no body by default" do
|
57
|
-
Chimps::Request.new('/path/to/something').body.should
|
57
|
+
Chimps::Request.new('/path/to/something').body.should be_empty
|
58
58
|
end
|
59
59
|
|
60
60
|
it "should encode a Hash of parameters when given" do
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chimps
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 31
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 6
|
10
|
+
version: 0.3.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Dhruv Bansal
|
@@ -15,8 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
19
|
-
default_executable:
|
18
|
+
date: 2011-05-18 00:00:00 Z
|
20
19
|
dependencies:
|
21
20
|
- !ruby/object:Gem::Dependency
|
22
21
|
name: json
|
@@ -133,7 +132,6 @@ files:
|
|
133
132
|
- spec/chimps/workflows/download_spec.rb
|
134
133
|
- spec/spec_helper.rb
|
135
134
|
- spec/support/custom_matchers.rb
|
136
|
-
has_rdoc: true
|
137
135
|
homepage: http://github.com/infochimps/chimps
|
138
136
|
licenses: []
|
139
137
|
|
@@ -163,7 +161,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
163
161
|
requirements: []
|
164
162
|
|
165
163
|
rubyforge_project:
|
166
|
-
rubygems_version: 1.
|
164
|
+
rubygems_version: 1.7.2
|
167
165
|
signing_key:
|
168
166
|
specification_version: 3
|
169
167
|
summary: Chimps is a Ruby interface for the Infochimps Catalog & Query APIs (http://www.infochimps.com/apis)
|