loquor 1.12.0 → 1.13.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NDMwODdkODY4NWMwY2ViZjkzOGE4MTczNTU1MGYwYjFiOTMwNmI2Mg==
4
+ ZmMxOWUyZWYyZjNmODFjOWY1OTUzYWFkNjE2MWEwNzMxZjdkMjQxNQ==
5
5
  data.tar.gz: !binary |-
6
- YTczMjQwNDQ1ZTdiZThkOTE2YWYyNWEzNTIyZDA3Zjc4ZTZiNDgxNA==
6
+ MTQwODIzNjdlOTI4OTZmNGY2NmMwYjk0NjM3ZWVmNWNhMDk5NjE3Zg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- ODdmZDYyYTJlY2MwMGMzN2YxZjNmZTlkMjQ4OWMxNTI2ZWNhODI4NzI4MDQ3
10
- MjlmMTdhNGIyNmU5YTZiMTZjMjNiNThkYzBkYTkzYTliN2RiNTkxNzQ1NmJi
11
- ZjZkNmEyZmI3NTczZWUwMDBmYjViOWY0YjRjMWU4OGUwNTE0YmU=
9
+ YTNiZDk5NGFlOGY4MjVkYWQ1Y2U1NGE4ZTc2MzYyYmVhNzA0NWNmNTE3YTRj
10
+ NjI1ZjgyZGE4ZmIyMWI4NTQ0ODBjYzliMmMyZmJjMDQ1ZDkyMmQ5MDA1OTlk
11
+ NzA4MWJjOTc2Mzg4ZmVjZGQ4N2FkOTBjY2IyYjNlYTQ2ZWFjYzg=
12
12
  data.tar.gz: !binary |-
13
- ZGMyOTNhOWFkZjNlYTU1ODY4NzgyYTZkYTc4YzU5ODk1MjA1Y2Q3MjRiNGU4
14
- ZTU3MjIwNWZkNDk1MWQ5ZDQyZWRlYWViZTVjNDA3YWRmOWQ1NGYwNWQyM2Ji
15
- ZDA0ZWY5ZTRlMmVkZjJiMTRkYzczZTg0MDBjMTFmMzEzYTkxYzE=
13
+ YjRhYjJkMTJmYTc4ODI1ZWU5YjNhODcxNTJlOWU4NDU1OTVhNDVjY2Q5YzJh
14
+ M2U4M2ZmYjg1Y2EyM2Y3MWU3N2E2MmE2NjM2MjFjZjYzZTc1NGFiYmVjZWQ0
15
+ YzVlNGM4ODM5YzI5MmRmN2RiNzI5NDUyMzBiYmNhYTJhNDY5NjY=
@@ -1,3 +1,6 @@
1
+ # 1.13.0 / 2014-05-19
2
+ * [BUGFIX] Ensure proper encoding of query params
3
+
1
4
  # 1.12.0 / 2014-05-06
2
5
  * [FEATURE] Retry support for HTTP 503 status
3
6
 
@@ -90,22 +90,22 @@ module Loquor
90
90
  def add_criteria(query_string, key, value)
91
91
  substitute_value = Loquor.config.substitute_values[value]
92
92
  if !substitute_value.nil?
93
- query_string << "#{key}=#{URI.encode(substitute_value)}"
93
+ query_string << "#{key}=#{URI.encode_www_form_component(substitute_value)}"
94
94
  else
95
95
  case value
96
96
  when String, Symbol, Numeric, Date, Time, DateTime
97
- query_string << "#{key}=#{URI.encode(value.to_s)}"
97
+ query_string << "#{key}=#{URI.encode_www_form_component(value.to_s)}"
98
98
  when Array
99
99
  if value.empty?
100
100
  query_string << "#{key}[]="
101
101
  else
102
102
  value.each do |v|
103
- query_string << "#{key}[]=#{URI.encode(v.to_s)}"
103
+ query_string << "#{key}[]=#{URI.encode_www_form_component(v.to_s)}"
104
104
  end
105
105
  end
106
106
  when Hash
107
107
  value.each do |k,v|
108
- query_string << "#{key}[#{k}]=#{URI.encode(v.to_s)}"
108
+ query_string << "#{key}[#{k}]=#{URI.encode_www_form_component(v.to_s)}"
109
109
  end
110
110
  else
111
111
  raise LoquorError.new("Filter values must be strings, arrays, date, time, datetime or single-depth hashes.")
@@ -1,3 +1,3 @@
1
1
  module Loquor
2
- VERSION = "1.12.0"
2
+ VERSION = "1.13.0"
3
3
  end
@@ -82,7 +82,7 @@ module Loquor
82
82
 
83
83
  def test_where_gets_correct_url_with_criteria
84
84
  searcher = ApiCall::Index.new(resource).where(name: 'Star Wars')
85
- assert searcher.send(:generate_url).include? "?name=Star%20Wars"
85
+ assert searcher.send(:generate_url).include? "?name=Star+Wars"
86
86
  end
87
87
 
88
88
  def test_where_gets_correct_url_with_symbol
@@ -90,6 +90,11 @@ module Loquor
90
90
  assert searcher.send(:generate_url).include? "?name=star"
91
91
  end
92
92
 
93
+ def test_generated_url_encodes_correctly
94
+ searcher = ApiCall::Index.new(resource).where(url: "http://www.example.com/resource.html?foo=bar&_foo=baz&content=Stuff%3A+that%2Fshould+%28be+escaped%29")
95
+ assert searcher.send(:generate_url).include? "?url=http%3A%2F%2Fwww.example.com%2Fresource.html%3Ffoo%3Dbar%26_foo%3Dbaz%26content%3DStuff%253A%2Bthat%252Fshould%2B%2528be%2Bescaped%2529"
96
+ end
97
+
93
98
  def test_where_gets_correct_url_with_date
94
99
  searcher = ApiCall::Index.new(resource).where(name: Date.new(1969,5,10))
95
100
  assert searcher.send(:generate_url).include? "?name=1969-05-10"
@@ -97,12 +102,12 @@ module Loquor
97
102
 
98
103
  def test_where_gets_correct_url_with_time
99
104
  searcher = ApiCall::Index.new(resource).where(name: Time.new(1969,5,10,13,10))
100
- assert searcher.send(:generate_url).include? "?name=1969-05-10%2013:10:00"
105
+ assert searcher.send(:generate_url).include? "?name=1969-05-10+13%3A10%3A00"
101
106
  end
102
107
 
103
108
  def test_where_gets_correct_url_with_date_time
104
109
  searcher = ApiCall::Index.new(resource).where(name: DateTime.new(1969,5,10,13,10))
105
- assert searcher.send(:generate_url).include? "?name=1969-05-10T13:10:00"
110
+ assert searcher.send(:generate_url).include? "?name=1969-05-10T13%3A10%3A00%2B00%3A00"
106
111
  end
107
112
 
108
113
  def test_where_gets_correct_url_with_number
@@ -150,7 +155,7 @@ module Loquor
150
155
  searcher = ApiCall::Index.new(resource).where(criteria)
151
156
  searcher.stubs(path: "foobar")
152
157
  url = searcher.send(:generate_url)
153
- assert url.include?("thing=:__true__")
158
+ assert url.include?("thing=%3A__true__")
154
159
  end
155
160
 
156
161
  def test_that_iterating_calls_results
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: loquor
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.12.0
4
+ version: 1.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Walker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-07 00:00:00.000000000 Z
11
+ date: 2014-05-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: filum