asari 0.12.1 → 0.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4dba92aa2cd1a63670a551f536f331652ac1c9e3
4
- data.tar.gz: 37fa06359fbb36a896c91bda3e85e7e2f0ecc841
3
+ metadata.gz: 54baa28b62335e23583d5e9da5939ec8bb108987
4
+ data.tar.gz: 95b665a1aebec36503b41d9b4cb7e0b2f9d7fafa
5
5
  SHA512:
6
- metadata.gz: 9db0ed3d5d1936e3d880cb6c1a5eedcd10aa3bf6acac0c4dc6d6a746d7c3e1661aa5a93b4c2ce2158e102eff65eca50a7b8e6e6fff38fbe85b92b7a64f01be88
7
- data.tar.gz: 8d4832d487772c3f8c465558ffc7389279ca783f7b7be810c6b4db406822c75dc9313c4342e78e70749e3ed781e7b76fac919c3b9f212c0f1e8870754e9a26e6
6
+ metadata.gz: 728fa33023f96338a4776c5b6ba9d149e3ae72dd273992f70efea3cae2cebda89827a40a218b48d4611695563cb4293e67d61a2df1f277019343ca48a40da8b9
7
+ data.tar.gz: eff402cf51a42167726ede40f145dcae12587de6210e6a1c3b23a6f1b986b3bc5cc6bcfca0f3804460d9e119ce02348cc7ea1767dedaf8df855375cd81730539
@@ -207,7 +207,7 @@ class Asari
207
207
  hash.reduce("") do |memo, (key, value)|
208
208
  if %w(and or not).include?(key.to_s) && value.is_a?(Hash)
209
209
  sub_query = reduce.call(value)
210
- memo += "(#{key}#{sub_query})" unless sub_query.empty?
210
+ memo += " (#{key}#{sub_query})" unless sub_query.empty?
211
211
  else
212
212
  if value.is_a?(Range) || value.is_a?(Integer)
213
213
  memo += " #{key}:#{value}"
@@ -1,3 +1,3 @@
1
1
  class Asari
2
- VERSION = "0.12.1"
2
+ VERSION = "0.13.0"
3
3
  end
@@ -118,46 +118,46 @@ describe Asari do
118
118
  end
119
119
 
120
120
  it "builds a query string from a passed hash" do
121
- HTTParty.should_receive(:get).with("http://search-testdomain.us-east-1.cloudsearch.amazonaws.com/2011-02-01/search?q=&bq=%28and+foo%3A%27bar%27+baz%3A%27bug%27%29&size=10")
121
+ HTTParty.should_receive(:get).with("http://search-testdomain.us-east-1.cloudsearch.amazonaws.com/2011-02-01/search?q=&bq=+%28and+foo%3A%27bar%27+baz%3A%27bug%27%29&size=10")
122
122
  @asari.search(filter: { and: { foo: "bar", baz: "bug" }})
123
123
  end
124
124
 
125
125
  it "honors the logic types" do
126
- HTTParty.should_receive(:get).with("http://search-testdomain.us-east-1.cloudsearch.amazonaws.com/2011-02-01/search?q=&bq=%28or+foo%3A%27bar%27+baz%3A%27bug%27%29&size=10")
126
+ HTTParty.should_receive(:get).with("http://search-testdomain.us-east-1.cloudsearch.amazonaws.com/2011-02-01/search?q=&bq=+%28or+foo%3A%27bar%27+baz%3A%27bug%27%29&size=10")
127
127
  @asari.search(filter: { or: { foo: "bar", baz: "bug" }})
128
128
  end
129
129
 
130
130
  it "supports nested logic" do
131
- HTTParty.should_receive(:get).with("http://search-testdomain.us-east-1.cloudsearch.amazonaws.com/2011-02-01/search?q=&bq=%28or+is_donut%3A%27true%27%28and+round%3A%27true%27+frosting%3A%27true%27+fried%3A%27true%27%29%29&size=10")
131
+ HTTParty.should_receive(:get).with("http://search-testdomain.us-east-1.cloudsearch.amazonaws.com/2011-02-01/search?q=&bq=+%28or+is_donut%3A%27true%27+%28and+round%3A%27true%27+frosting%3A%27true%27+fried%3A%27true%27%29%29&size=10")
132
132
  @asari.search(filter: { or: { is_donut: true, and:
133
133
  { round: true, frosting: true, fried: true }}
134
134
  })
135
135
  end
136
136
 
137
137
  it "supports ruby native numeric ranges" do
138
- HTTParty.should_receive(:get).with("http://search-testdomain.us-east-1.cloudsearch.amazonaws.com/2011-02-01/search?q=&bq=%28and+bottles%3A1..99+on%3A%27wall%27%29&size=10")
138
+ HTTParty.should_receive(:get).with("http://search-testdomain.us-east-1.cloudsearch.amazonaws.com/2011-02-01/search?q=&bq=+%28and+bottles%3A1..99+on%3A%27wall%27%29&size=10")
139
139
  @asari.search(filter: { and: { bottles: (1..99), on: "wall"} })
140
140
  end
141
141
 
142
142
  it "it supports numeric ranges where the lower bound is open-ended" do
143
- HTTParty.should_receive(:get).with("http://search-testdomain.us-east-1.cloudsearch.amazonaws.com/2011-02-01/search?q=&bq=%28and+bottles%3A..99+on%3A%27wall%27%29&size=10")
143
+ HTTParty.should_receive(:get).with("http://search-testdomain.us-east-1.cloudsearch.amazonaws.com/2011-02-01/search?q=&bq=+%28and+bottles%3A..99+on%3A%27wall%27%29&size=10")
144
144
  @asari.search(filter: { and: { bottles: '..99', on: "wall"} })
145
145
  end
146
146
 
147
147
  it "it supports numeric ranges where the upper bound is open-ended" do
148
- HTTParty.should_receive(:get).with("http://search-testdomain.us-east-1.cloudsearch.amazonaws.com/2011-02-01/search?q=&bq=%28and+bottles%3A1..+on%3A%27wall%27%29&size=10")
148
+ HTTParty.should_receive(:get).with("http://search-testdomain.us-east-1.cloudsearch.amazonaws.com/2011-02-01/search?q=&bq=+%28and+bottles%3A1..+on%3A%27wall%27%29&size=10")
149
149
  @asari.search(filter: { and: { bottles: '1..', on: "wall"} })
150
150
  end
151
151
 
152
152
  it "fails gracefully with empty params" do
153
- HTTParty.should_receive(:get).with("http://search-testdomain.us-east-1.cloudsearch.amazonaws.com/2011-02-01/search?q=&bq=%28or+is_donut%3A%27true%27%29&size=10")
153
+ HTTParty.should_receive(:get).with("http://search-testdomain.us-east-1.cloudsearch.amazonaws.com/2011-02-01/search?q=&bq=+%28or+is_donut%3A%27true%27%29&size=10")
154
154
  @asari.search(filter: { or: { is_donut: true, and:
155
155
  { round: "", frosting: nil, fried: nil }}
156
156
  })
157
157
  end
158
158
 
159
159
  it "supports full text search and boolean searching" do
160
- HTTParty.should_receive(:get).with("http://search-testdomain.us-east-1.cloudsearch.amazonaws.com/2011-02-01/search?q=nom&bq=%28or+is_donut%3A%27true%27%28and+fried%3A%27true%27%29%29&size=10")
160
+ HTTParty.should_receive(:get).with("http://search-testdomain.us-east-1.cloudsearch.amazonaws.com/2011-02-01/search?q=nom&bq=+%28or+is_donut%3A%27true%27+%28and+fried%3A%27true%27%29%29&size=10")
161
161
  @asari.search("nom", filter: { or: { is_donut: true, and:
162
162
  { round: "", frosting: nil, fried: true }}
163
163
  })
@@ -166,7 +166,7 @@ describe Asari do
166
166
 
167
167
  describe "geography searching" do
168
168
  it "builds a proper query string" do
169
- HTTParty.should_receive(:get).with("http://search-testdomain.us-east-1.cloudsearch.amazonaws.com/2011-02-01/search?q=&bq=%28and+lat%3A2505771415..2506771417+lng%3A2358260777..2359261578%29&size=10")
169
+ HTTParty.should_receive(:get).with("http://search-testdomain.us-east-1.cloudsearch.amazonaws.com/2011-02-01/search?q=&bq=+%28and+lat%3A2505771415..2506771417+lng%3A2358260777..2359261578%29&size=10")
170
170
  @asari.search filter: { and: Asari::Geography.coordinate_box(meters: 5000, lat: 45.52, lng: 122.6819) }
171
171
  end
172
172
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: asari
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.1
4
+ version: 0.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tommy Morgan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-06 00:00:00.000000000 Z
11
+ date: 2018-02-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty