loquor 1.7.0 → 1.8.0

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: 0207ff4371ea8daf3f959df6bac057d676666e7b
4
- data.tar.gz: a10652e0df52283f7a0472fddd7002243af6a2a6
3
+ metadata.gz: 2235b851b596e4ab7c4c0647d0794dfb5a03ef83
4
+ data.tar.gz: b535cfaa4426ec6472657772f158a4b93fba0de1
5
5
  SHA512:
6
- metadata.gz: 3a6e012d933a0a94b5b389958699b895a87e646e4ae73cf9e677b6cbac6111363ab759e0076e016d017195224dd83b6cecd7317cc1a097123604fdcafbb38c64
7
- data.tar.gz: 4a7cd33b185e61bf519ace8175969171273267d92eefd07aa4e68ce3e17e606bbb4a05b1382c2543b3b2809d32d39ac9e0a5da3cb9f32cf0571e38002e9f98cf
6
+ metadata.gz: a467f81421afdd64570918f3e6cdbd56a43abef9fe3304499b7bff96104279191347f9c123835d6f7e53a6fc2bf240658a9dab2263f929140c626f4be76509db
7
+ data.tar.gz: 5caac15616d535425ca1cee9930109612c15c361ee1f3dec8af1c29aa513411f0720644820aca38fda2468f313da104edeedd899ce963ce7ef13c93db206fde8
@@ -1,3 +1,6 @@
1
+ # 1.8.0 / 2014-03-31
2
+ * [FEATURE] Allow empty hash values in index criteria
3
+
1
4
  # 1.7.0 / 2014-03-13
2
5
  * [FEATURE] Add support for per, page and limit
3
6
 
@@ -96,8 +96,12 @@ module Loquor
96
96
  when String, Symbol, Numeric, Date, Time, DateTime
97
97
  query_string << "#{key}=#{URI.encode(value.to_s)}"
98
98
  when Array
99
- value.each do |v|
100
- query_string << "#{key}[]=#{URI.encode(v.to_s)}"
99
+ if value.empty?
100
+ query_string << "#{key}[]="
101
+ else
102
+ value.each do |v|
103
+ query_string << "#{key}[]=#{URI.encode(v.to_s)}"
104
+ end
101
105
  end
102
106
  when Hash
103
107
  value.each do |k,v|
@@ -1,3 +1,3 @@
1
1
  module Loquor
2
- VERSION = "1.7.0"
2
+ VERSION = "1.8.0"
3
3
  end
@@ -50,6 +50,12 @@ module Loquor
50
50
  assert_equal({genre: 'Animation'}, searcher.criteria)
51
51
  end
52
52
 
53
+ def test_where_sets_empty_hash_value_criteria
54
+ criteria = {genre: []}
55
+ searcher = ApiCall::Index.new(resource).where(criteria)
56
+ assert_equal({genre: []}, searcher.criteria)
57
+ end
58
+
53
59
  def test_where_merges_criteria
54
60
  criteria1 = {genre: 'Animation'}
55
61
  criteria2 = {foobar: 'Cat'}
@@ -69,7 +75,12 @@ module Loquor
69
75
  assert searcher.send(:generate_url).include? "?clauses[]=WHERE%201=1"
70
76
  end
71
77
 
72
- def test_where_gets_correct_url_with_crtieria
78
+ def test_where_gets_correct_url_with_empty_criteria_hash_value
79
+ searcher = ApiCall::Index.new(resource).where(ids: [])
80
+ assert searcher.send(:generate_url).include? "?ids[]="
81
+ end
82
+
83
+ def test_where_gets_correct_url_with_criteria
73
84
  searcher = ApiCall::Index.new(resource).where(name: 'Star Wars')
74
85
  assert searcher.send(:generate_url).include? "?name=Star%20Wars"
75
86
  end
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.7.0
4
+ version: 1.8.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-03-13 00:00:00.000000000 Z
11
+ date: 2014-03-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: filum