rufus-jig 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.txt +6 -0
- data/TODO.txt +2 -0
- data/lib/rufus/jig/http.rb +2 -1
- data/lib/rufus/jig/version.rb +1 -1
- data/rufus-jig.gemspec +2 -2
- data/test/server.rb +7 -0
- data/test/ut_0_http_get.rb +15 -0
- metadata +2 -2
data/CHANGELOG.txt
CHANGED
@@ -2,6 +2,12 @@
|
|
2
2
|
= rufus-jig CHANGELOG.txt
|
3
3
|
|
4
4
|
|
5
|
+
== rufus-jig - 0.1.7 not yet released
|
6
|
+
|
7
|
+
- implemented :force_json => true for services returning JSON in plain/text
|
8
|
+
- :accept => :json as a shorcut for :accept -> 'application/json'
|
9
|
+
|
10
|
+
|
5
11
|
== rufus-jig - 0.1.6 released 2009/12/21
|
6
12
|
|
7
13
|
- implemented close for Http and Couch classes
|
data/TODO.txt
CHANGED
data/lib/rufus/jig/http.rb
CHANGED
@@ -192,6 +192,7 @@ module Rufus::Jig
|
|
192
192
|
def rehash_options (opts)
|
193
193
|
|
194
194
|
opts['Accept'] ||= (opts.delete(:accept) || 'application/json')
|
195
|
+
opts['Accept'] = 'application/json' if opts['Accept'] == :json
|
195
196
|
|
196
197
|
if ct = opts.delete(:content_type)
|
197
198
|
opts['Content-Type'] = ct
|
@@ -267,7 +268,7 @@ module Rufus::Jig
|
|
267
268
|
b = response.body
|
268
269
|
ct = response.headers['Content-Type']
|
269
270
|
|
270
|
-
if ct && ct.match(/^application\/json/)
|
271
|
+
if opts[:force_json] || (ct && ct.match(/^application\/json/))
|
271
272
|
Rufus::Jig::Json.decode(b)
|
272
273
|
else
|
273
274
|
b
|
data/lib/rufus/jig/version.rb
CHANGED
data/rufus-jig.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{rufus-jig}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.7"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["John Mettraux", "Kenneth Kalmer"]
|
12
|
-
s.date = %q{2009-12-
|
12
|
+
s.date = %q{2009-12-24}
|
13
13
|
s.description = %q{
|
14
14
|
Json Internet Get.
|
15
15
|
|
data/test/server.rb
CHANGED
data/test/ut_0_http_get.rb
CHANGED
@@ -84,6 +84,21 @@ class UtHttpGetTest < Test::Unit::TestCase
|
|
84
84
|
assert_equal 'Saab', r['car']
|
85
85
|
|
86
86
|
assert_equal 0, @h.cache.size
|
87
|
+
|
88
|
+
r = @h.get('/document_accept', :accept => :json)
|
89
|
+
|
90
|
+
assert_equal Hash, r.class
|
91
|
+
end
|
92
|
+
|
93
|
+
def test_get_force_json
|
94
|
+
|
95
|
+
r = @h.get('/document_json_plain', :accept => :json)
|
96
|
+
|
97
|
+
assert_equal('{"car":"Peugeot"}', r)
|
98
|
+
|
99
|
+
r = @h.get('/document_json_plain', :force_json => true)
|
100
|
+
|
101
|
+
assert_equal({ 'car' => 'Peugeot' }, r)
|
87
102
|
end
|
88
103
|
|
89
104
|
def test_conditional_get
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rufus-jig
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Mettraux
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2009-12-
|
13
|
+
date: 2009-12-24 00:00:00 +09:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|