restulicious 0.1.8 → 0.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md
CHANGED
@@ -6,7 +6,7 @@ TODO: Write a gem description
|
|
6
6
|
|
7
7
|
Add this line to your application's Gemfile:
|
8
8
|
|
9
|
-
gem '
|
9
|
+
gem 'restulicious'
|
10
10
|
|
11
11
|
And then execute:
|
12
12
|
|
@@ -14,7 +14,7 @@ And then execute:
|
|
14
14
|
|
15
15
|
Or install it yourself as:
|
16
16
|
|
17
|
-
$ gem install
|
17
|
+
$ gem install restulicious
|
18
18
|
|
19
19
|
## Usage
|
20
20
|
|
@@ -1,3 +1,4 @@
|
|
1
|
+
#TODO: Split out this adapter into a separate gem
|
1
2
|
module Restulicious
|
2
3
|
module Adapter
|
3
4
|
class RESTApi
|
@@ -40,6 +41,7 @@ module Restulicious
|
|
40
41
|
Restulicious.config.parser_class.new(@klazz, @key, response.body)
|
41
42
|
end
|
42
43
|
|
44
|
+
#TODO: Check whether this can be deleted
|
43
45
|
def hydra
|
44
46
|
Restulicious.config.hydra
|
45
47
|
end
|
@@ -50,7 +52,7 @@ module Restulicious
|
|
50
52
|
|
51
53
|
def run_request
|
52
54
|
@request.queue if @request.respond_to?(:queue)
|
53
|
-
|
55
|
+
::RESTApi.run
|
54
56
|
parser(@request.response).result
|
55
57
|
end
|
56
58
|
|
@@ -72,7 +74,9 @@ module Restulicious
|
|
72
74
|
end
|
73
75
|
if block_given?
|
74
76
|
@request.on_complete do |response|
|
75
|
-
|
77
|
+
if response.success?
|
78
|
+
block.call(parser(response).result)
|
79
|
+
end
|
76
80
|
end
|
77
81
|
end
|
78
82
|
if should_run_request?(&block)
|
@@ -46,7 +46,7 @@ module Restulicious
|
|
46
46
|
def interpolated_url
|
47
47
|
interpolated_url = @url
|
48
48
|
@params.each do |key, value|
|
49
|
-
interpolated_url = interpolated_url.gsub /:#{key}/, value.to_s
|
49
|
+
interpolated_url = interpolated_url.gsub /:#{key}/, Typhoeus::Utils.escape(value.to_s)
|
50
50
|
end
|
51
51
|
interpolated_url
|
52
52
|
end
|
data/lib/restulicious/version.rb
CHANGED
@@ -55,6 +55,11 @@ describe Restulicious::QueryInterface do
|
|
55
55
|
it "uses full url" do
|
56
56
|
assert_equal "http://bigdeal.com/the/next/:thing", @interface.all_url
|
57
57
|
end
|
58
|
+
|
59
|
+
it "URL encodes param values during interpolation" do
|
60
|
+
@interface.where(thing: "super#")
|
61
|
+
assert_equal "http://bigdeal.com/the/next/super%23", @interface.all_url
|
62
|
+
end
|
58
63
|
end
|
59
64
|
|
60
65
|
describe "first_url" do
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: restulicious
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.11
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-03-18 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -157,21 +157,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
157
157
|
- - ! '>='
|
158
158
|
- !ruby/object:Gem::Version
|
159
159
|
version: '0'
|
160
|
-
segments:
|
161
|
-
- 0
|
162
|
-
hash: 3646070466362267354
|
163
160
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
164
161
|
none: false
|
165
162
|
requirements:
|
166
163
|
- - ! '>='
|
167
164
|
- !ruby/object:Gem::Version
|
168
165
|
version: '0'
|
169
|
-
segments:
|
170
|
-
- 0
|
171
|
-
hash: 3646070466362267354
|
172
166
|
requirements: []
|
173
167
|
rubyforge_project:
|
174
|
-
rubygems_version: 1.8.
|
168
|
+
rubygems_version: 1.8.25
|
175
169
|
signing_key:
|
176
170
|
specification_version: 3
|
177
171
|
summary: Simplifies consumption of restful APIs, including a query interface like
|