loquor 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d25bbd9a9af995c7ab8646c218a8d9b9953a7e23
4
- data.tar.gz: 4a72ae1708c8813640fa881810cee0e570254e20
3
+ metadata.gz: b430fae340a3898dcf526d61317f9fe6cb4be411
4
+ data.tar.gz: 4801c67bcb3f76ba6a1bb13e4b191f70110a7563
5
5
  SHA512:
6
- metadata.gz: 7657584a766d95803f867d03fc3342a91322be37994b543f7b05cd548a7549b5eb1d8a7e7e1d07aac797ffee3165ead750f42796ee3a6bfa1c3ebeaab8975d4d
7
- data.tar.gz: 7d8eb633001bd4ed487155a00457adc38bde2f820de5a13bf5b6b6039a12941ad8126063eef240fb04d703cc7eac5303a42b72cebae9eea9a078319f0dd84de3
6
+ metadata.gz: 91d277a7228bab67d6749f2fc078b414a6c1831d39c2c5536cfd6b2af9090ed02a98d112fa7fba23652a77d35beae0bae90da9a5d4f93b7d0eb9c99e475b0845
7
+ data.tar.gz: f1d97ba2283fb6c6ee3dc4225006cbc25862e72b99b17b4a3ee8158c6ad072202bf5a45662afa7cc573706fbbdbd38b694a52e67909b900008be1de9f813d276
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ # 0.5.1 / 2013-12-04
2
+ * [FEATURE] Convert symbols and numbers to strings in where clauses
3
+
1
4
  # 0.5.0 / 2013-12-04
2
5
  * [FEATURE] Add support for select
3
6
 
@@ -52,11 +52,12 @@ module Loquor
52
52
  def generate_url
53
53
  query_string = []
54
54
  @criteria.each do |key,value|
55
- if value.is_a?(String)
56
- query_string << "#{key}=#{URI.encode(value)}"
57
- elsif value.is_a?(Array)
55
+ case value
56
+ when String, Symbol, Numeric
57
+ query_string << "#{key}=#{URI.encode(value.to_s)}"
58
+ when Array
58
59
  value.each do |v|
59
- query_string << "#{key}[]=#{URI.encode(v)}"
60
+ query_string << "#{key}[]=#{URI.encode(v.to_s)}"
60
61
  end
61
62
  else
62
63
  raise LoquorError.new("Filter values must be strings or arrays.")
@@ -1,3 +1,3 @@
1
1
  module Loquor
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.1"
3
3
  end
@@ -39,6 +39,26 @@ module Loquor
39
39
  assert searcher.send(:generate_url).include? "?name=Star%20Wars"
40
40
  end
41
41
 
42
+ def test_where_gets_correct_url_with_symbol
43
+ searcher = ApiCall::Index.new(resource).where(name: :star)
44
+ assert searcher.send(:generate_url).include? "?name=star"
45
+ end
46
+
47
+ def test_where_gets_correct_url_with_number
48
+ searcher = ApiCall::Index.new(resource).where(name: 1)
49
+ assert searcher.send(:generate_url).include? "?name=1"
50
+ end
51
+
52
+ def test_where_gets_correct_url_with_hashed_symbols
53
+ searcher = ApiCall::Index.new(resource).where(name: [:star, :wars])
54
+ assert searcher.send(:generate_url).include? "?name[]=star&name[]=wars"
55
+ end
56
+
57
+ def test_where_gets_correct_url_with_hashed_integers
58
+ searcher = ApiCall::Index.new(resource).where(name: [1,2])
59
+ assert searcher.send(:generate_url).include? "?name[]=1&name[]=2"
60
+ end
61
+
42
62
  def test_where_works_with_array_in_a_hash
43
63
  criteria = {thing: ['foo', 'bar']}
44
64
  searcher = ApiCall::Index.new(resource).where(criteria)
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: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Walker
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-04 00:00:00.000000000 Z
11
+ date: 2013-12-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: filum
@@ -173,7 +173,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
173
173
  version: '0'
174
174
  requirements: []
175
175
  rubyforge_project:
176
- rubygems_version: 2.1.9
176
+ rubygems_version: 2.0.3
177
177
  signing_key:
178
178
  specification_version: 4
179
179
  summary: This library dispatches requests to Meducation
@@ -191,4 +191,3 @@ test_files:
191
191
  - test/object_hash_test.rb
192
192
  - test/resource_test.rb
193
193
  - test/test_helper.rb
194
- has_rdoc: