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 +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/loquor/api_calls/index.rb +5 -4
- data/lib/loquor/version.rb +1 -1
- data/test/api_calls/index_test.rb +20 -0
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b430fae340a3898dcf526d61317f9fe6cb4be411
|
4
|
+
data.tar.gz: 4801c67bcb3f76ba6a1bb13e4b191f70110a7563
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 91d277a7228bab67d6749f2fc078b414a6c1831d39c2c5536cfd6b2af9090ed02a98d112fa7fba23652a77d35beae0bae90da9a5d4f93b7d0eb9c99e475b0845
|
7
|
+
data.tar.gz: f1d97ba2283fb6c6ee3dc4225006cbc25862e72b99b17b4a3ee8158c6ad072202bf5a45662afa7cc573706fbbdbd38b694a52e67909b900008be1de9f813d276
|
data/CHANGELOG.md
CHANGED
@@ -52,11 +52,12 @@ module Loquor
|
|
52
52
|
def generate_url
|
53
53
|
query_string = []
|
54
54
|
@criteria.each do |key,value|
|
55
|
-
|
56
|
-
|
57
|
-
|
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.")
|
data/lib/loquor/version.rb
CHANGED
@@ -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.
|
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-
|
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.
|
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:
|