shutl_resource 0.11.3 → 0.11.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,4 @@
1
+ require 'open-uri'
1
2
  module Shutl::Resource
2
3
  module RestClassMethods
3
4
  def base_uri uri
@@ -312,8 +313,9 @@ module Shutl::Resource
312
313
 
313
314
  url = URI.escape url
314
315
  unless params.empty?
315
- url += '?'
316
- params.each { |key, value| url += "#{key}=#{value}&" }
316
+ url += '?' + params.entries.map do |key, value|
317
+ URI::encode "#{key}=#{value}"
318
+ end.join("&")
317
319
  end
318
320
  url
319
321
  end
@@ -1,5 +1,5 @@
1
1
  module Shutl
2
2
  module Resource
3
- VERSION = '0.11.3'
3
+ VERSION = '0.11.4'
4
4
  end
5
5
  end
@@ -79,6 +79,24 @@ describe Shutl::Resource::Rest do
79
79
 
80
80
  request.should have_been_requested
81
81
  end
82
+
83
+ it 'should support the params with invalid uri name' do
84
+ request = stub_request(:get, 'http://host/nested/10/resources?arg1=val1&arg%2B2=val2').
85
+ to_return(body: '{"nested_resources": []}', headers: headers)
86
+
87
+ NestedResource.all(parent_id: 10, arg1: 'val1', :'arg 2' => 'val2')
88
+
89
+ request.should have_been_requested
90
+ end
91
+
92
+ it 'should support the params with invalid uri value' do
93
+ request = stub_request(:get, 'http://host/nested/10/resources?arg1=val1&arg2=val%202').
94
+ to_return(body: '{"nested_resources": []}', headers: headers)
95
+
96
+ NestedResource.all(parent_id: 10, arg1: 'val1', arg2: 'val 2')
97
+
98
+ request.should have_been_requested
99
+ end
82
100
  end
83
101
 
84
102
  describe '#find' do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shutl_resource
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.3
4
+ version: 0.11.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,11 +11,11 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2013-07-22 00:00:00.000000000 Z
14
+ date: 2013-08-01 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: httparty
18
- requirement: &70098456220820 !ruby/object:Gem::Requirement
18
+ requirement: !ruby/object:Gem::Requirement
19
19
  none: false
20
20
  requirements:
21
21
  - - ~>
@@ -23,21 +23,31 @@ dependencies:
23
23
  version: 0.10.0
24
24
  type: :runtime
25
25
  prerelease: false
26
- version_requirements: *70098456220820
26
+ version_requirements: !ruby/object:Gem::Requirement
27
+ none: false
28
+ requirements:
29
+ - - ~>
30
+ - !ruby/object:Gem::Version
31
+ version: 0.10.0
27
32
  - !ruby/object:Gem::Dependency
28
33
  name: shutl_auth
29
- requirement: &70098456218360 !ruby/object:Gem::Requirement
34
+ requirement: !ruby/object:Gem::Requirement
30
35
  none: false
31
36
  requirements:
32
- - - =
37
+ - - '='
33
38
  - !ruby/object:Gem::Version
34
39
  version: 0.8.0
35
40
  type: :runtime
36
41
  prerelease: false
37
- version_requirements: *70098456218360
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ none: false
44
+ requirements:
45
+ - - '='
46
+ - !ruby/object:Gem::Version
47
+ version: 0.8.0
38
48
  - !ruby/object:Gem::Dependency
39
49
  name: activemodel
40
- requirement: &70098456215180 !ruby/object:Gem::Requirement
50
+ requirement: !ruby/object:Gem::Requirement
41
51
  none: false
42
52
  requirements:
43
53
  - - ! '>='
@@ -45,10 +55,15 @@ dependencies:
45
55
  version: '0'
46
56
  type: :runtime
47
57
  prerelease: false
48
- version_requirements: *70098456215180
58
+ version_requirements: !ruby/object:Gem::Requirement
59
+ none: false
60
+ requirements:
61
+ - - ! '>='
62
+ - !ruby/object:Gem::Version
63
+ version: '0'
49
64
  - !ruby/object:Gem::Dependency
50
65
  name: faraday
51
- requirement: &70098456214640 !ruby/object:Gem::Requirement
66
+ requirement: !ruby/object:Gem::Requirement
52
67
  none: false
53
68
  requirements:
54
69
  - - ! '>='
@@ -56,10 +71,15 @@ dependencies:
56
71
  version: '0'
57
72
  type: :runtime
58
73
  prerelease: false
59
- version_requirements: *70098456214640
74
+ version_requirements: !ruby/object:Gem::Requirement
75
+ none: false
76
+ requirements:
77
+ - - ! '>='
78
+ - !ruby/object:Gem::Version
79
+ version: '0'
60
80
  - !ruby/object:Gem::Dependency
61
81
  name: faraday_middleware
62
- requirement: &70098456214100 !ruby/object:Gem::Requirement
82
+ requirement: !ruby/object:Gem::Requirement
63
83
  none: false
64
84
  requirements:
65
85
  - - ! '>='
@@ -67,10 +87,15 @@ dependencies:
67
87
  version: '0'
68
88
  type: :runtime
69
89
  prerelease: false
70
- version_requirements: *70098456214100
90
+ version_requirements: !ruby/object:Gem::Requirement
91
+ none: false
92
+ requirements:
93
+ - - ! '>='
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
71
96
  - !ruby/object:Gem::Dependency
72
97
  name: faraday-conductivity
73
- requirement: &70098456213460 !ruby/object:Gem::Requirement
98
+ requirement: !ruby/object:Gem::Requirement
74
99
  none: false
75
100
  requirements:
76
101
  - - ! '>='
@@ -78,10 +103,15 @@ dependencies:
78
103
  version: '0'
79
104
  type: :runtime
80
105
  prerelease: false
81
- version_requirements: *70098456213460
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ none: false
108
+ requirements:
109
+ - - ! '>='
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
82
112
  - !ruby/object:Gem::Dependency
83
113
  name: rake
84
- requirement: &70098456212800 !ruby/object:Gem::Requirement
114
+ requirement: !ruby/object:Gem::Requirement
85
115
  none: false
86
116
  requirements:
87
117
  - - ! '>='
@@ -89,10 +119,15 @@ dependencies:
89
119
  version: '0'
90
120
  type: :development
91
121
  prerelease: false
92
- version_requirements: *70098456212800
122
+ version_requirements: !ruby/object:Gem::Requirement
123
+ none: false
124
+ requirements:
125
+ - - ! '>='
126
+ - !ruby/object:Gem::Version
127
+ version: '0'
93
128
  - !ruby/object:Gem::Dependency
94
129
  name: rspec
95
- requirement: &70098456212100 !ruby/object:Gem::Requirement
130
+ requirement: !ruby/object:Gem::Requirement
96
131
  none: false
97
132
  requirements:
98
133
  - - ~>
@@ -100,10 +135,15 @@ dependencies:
100
135
  version: 2.11.0
101
136
  type: :development
102
137
  prerelease: false
103
- version_requirements: *70098456212100
138
+ version_requirements: !ruby/object:Gem::Requirement
139
+ none: false
140
+ requirements:
141
+ - - ~>
142
+ - !ruby/object:Gem::Version
143
+ version: 2.11.0
104
144
  - !ruby/object:Gem::Dependency
105
145
  name: debugger
106
- requirement: &70098456211660 !ruby/object:Gem::Requirement
146
+ requirement: !ruby/object:Gem::Requirement
107
147
  none: false
108
148
  requirements:
109
149
  - - ! '>='
@@ -111,10 +151,15 @@ dependencies:
111
151
  version: '0'
112
152
  type: :development
113
153
  prerelease: false
114
- version_requirements: *70098456211660
154
+ version_requirements: !ruby/object:Gem::Requirement
155
+ none: false
156
+ requirements:
157
+ - - ! '>='
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
115
160
  - !ruby/object:Gem::Dependency
116
161
  name: webmock
117
- requirement: &70098456210840 !ruby/object:Gem::Requirement
162
+ requirement: !ruby/object:Gem::Requirement
118
163
  none: false
119
164
  requirements:
120
165
  - - ~>
@@ -122,7 +167,12 @@ dependencies:
122
167
  version: 1.8.7
123
168
  type: :development
124
169
  prerelease: false
125
- version_requirements: *70098456210840
170
+ version_requirements: !ruby/object:Gem::Requirement
171
+ none: false
172
+ requirements:
173
+ - - ~>
174
+ - !ruby/object:Gem::Version
175
+ version: 1.8.7
126
176
  description: Shutl Rest resource
127
177
  email:
128
178
  - davidr@shutl.co.uk
@@ -170,15 +220,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
170
220
  - - ! '>='
171
221
  - !ruby/object:Gem::Version
172
222
  version: '0'
223
+ segments:
224
+ - 0
225
+ hash: 2169590113851625872
173
226
  required_rubygems_version: !ruby/object:Gem::Requirement
174
227
  none: false
175
228
  requirements:
176
229
  - - ! '>='
177
230
  - !ruby/object:Gem::Version
178
231
  version: '0'
232
+ segments:
233
+ - 0
234
+ hash: 2169590113851625872
179
235
  requirements: []
180
236
  rubyforge_project:
181
- rubygems_version: 1.8.11
237
+ rubygems_version: 1.8.25
182
238
  signing_key:
183
239
  specification_version: 3
184
240
  summary: Manage Shutl Rest resource. Parse/Serialize JSON
@@ -192,4 +248,3 @@ test_files:
192
248
  - spec/support/configured_base_uri_resource.rb
193
249
  - spec/support/test_resource.rb
194
250
  - spec/support/test_singular_resource.rb
195
- has_rdoc: