cloud_search 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -66,7 +66,7 @@ module CloudSearch
66
66
 
67
67
  def start
68
68
  return 0 if page_number <= 1
69
- (items_per_page * (page_number - 1)) + 1
69
+ (items_per_page * (page_number - 1))
70
70
  end
71
71
 
72
72
  def url
@@ -1,3 +1,3 @@
1
1
  module CloudSearch
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
@@ -202,42 +202,5 @@ describe CloudSearch::SearchResponse do
202
202
  subject.body = seven_hits_hash.to_json
203
203
  subject.current_page.should == 3
204
204
  end
205
-
206
- it "calculates offset based on current page and items_per_page" do
207
- subject.items_per_page = 3
208
- seven_hits_hash['hits']['start'] = nil
209
- subject.body = seven_hits_hash.to_json
210
- subject.offset.should == 0
211
-
212
- subject.items_per_page = 3
213
- seven_hits_hash['hits']['start'] = 0
214
- subject.body = seven_hits_hash.to_json
215
- subject.offset.should == 0
216
-
217
- subject.items_per_page = 3
218
- seven_hits_hash['hits']['start'] = 2
219
- subject.body = seven_hits_hash.to_json
220
- subject.offset.should == 0
221
-
222
- subject.items_per_page = 3
223
- seven_hits_hash['hits']['start'] = 3
224
- subject.body = seven_hits_hash.to_json
225
- subject.offset.should == 3
226
-
227
- subject.items_per_page = 3
228
- seven_hits_hash['hits']['start'] = 4
229
- subject.body = seven_hits_hash.to_json
230
- subject.offset.should == 3
231
-
232
- subject.items_per_page = 3
233
- seven_hits_hash['hits']['start'] = 5
234
- subject.body = seven_hits_hash.to_json
235
- subject.offset.should == 3
236
-
237
- subject.items_per_page = 3
238
- seven_hits_hash['hits']['start'] = 6
239
- subject.body = seven_hits_hash.to_json
240
- subject.offset.should == 6
241
- end
242
205
  end
243
206
  end
@@ -127,8 +127,8 @@ describe CloudSearch::Searcher do
127
127
  subject.page_number.should == 1
128
128
  end
129
129
 
130
- it "returns cloud search url with start at 11" do
131
- subject.at_page(2).url.should == "#{url_prefix}q=&size=10&start=11"
130
+ it "returns cloud search url with start at 10" do
131
+ subject.at_page(2).url.should == "#{url_prefix}q=&size=10&start=10"
132
132
  end
133
133
  end
134
134
 
@@ -149,9 +149,9 @@ describe CloudSearch::Searcher do
149
149
  subject.start.should == 0
150
150
  end
151
151
 
152
- it "returns start index 19 for page 2" do
152
+ it "returns start index 10 for page 2" do
153
153
  subject.at_page(2)
154
- subject.start.should == 11
154
+ subject.start.should == 10
155
155
  end
156
156
  end
157
157
 
@@ -2,7 +2,7 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: get
5
- uri: http://search-imdb-movies-pl6u4t3elu7dhsbwaqbsy3y6be.us-east-1.cloudsearch.amazonaws.com/2011-02-01/search?q=star%20wars&return-fields=actor,director,title,year,text_relevance&size=4&start=5
5
+ uri: http://search-imdb-movies-pl6u4t3elu7dhsbwaqbsy3y6be.us-east-1.cloudsearch.amazonaws.com/2011-02-01/search?q=star%20wars&return-fields=actor,director,title,year,text_relevance&size=4&start=4
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
@@ -16,33 +16,66 @@ http_interactions:
16
16
  response:
17
17
  status:
18
18
  code: 200
19
- message: OK
19
+ message: !binary |-
20
+ T0s=
20
21
  headers:
21
- Content-Type:
22
- - application/json
23
- Date:
24
- - Fri, 19 Oct 2012 12:54:26 GMT
25
- Server:
26
- - Server
27
- Content-Length:
28
- - '1235'
29
- Connection:
30
- - keep-alive
22
+ !binary "Q29udGVudC1UeXBl":
23
+ - !binary |-
24
+ YXBwbGljYXRpb24vanNvbg==
25
+ !binary "RGF0ZQ==":
26
+ - !binary |-
27
+ V2VkLCAyNCBPY3QgMjAxMiAxMTo1NTo0NCBHTVQ=
28
+ !binary "U2VydmVy":
29
+ - !binary |-
30
+ U2VydmVy
31
+ !binary "Q29udGVudC1MZW5ndGg=":
32
+ - !binary |-
33
+ MTczNQ==
34
+ !binary "Q29ubmVjdGlvbg==":
35
+ - !binary |-
36
+ a2VlcC1hbGl2ZQ==
31
37
  body:
32
- encoding: US-ASCII
33
- string: ! '{"rank":"-text_relevance","match-expr":"(label ''star wars'')","hits":{"found":7,"start":5,"hit":[{"id":"tt0086190","data":{"actor":["Altman,
34
- John","Bonehill, Richard","Brooke, Paul","Burtt, Ben","Daniels, Anthony","Diamond,
35
- Peter","Fisher, Carrie","Ford, Harrison","Hamill, Mark","Jones, James Earl","Marquand,
36
- Richard","Mayhew, Peter","McDiarmid, Ian","McRae, Hilton","Oz, Frank","Roy,
37
- Deep","Shaw, Sebastian","Ward, Larry","Welsh, Pat","Williams, Billy Dee"],"director":["Marquand,
38
- Richard"],"text_relevance":["268"],"title":["Star Wars: Episode VI - Return
39
- of the Jedi"],"year":["1983"]}},{"id":"tt0121766","data":{"actor":["Bai, Ling","Bryant,
40
- Gene","Castle-Hughes, Keisha","Christensen, Hayden","Cooke, Ben","Daniels,
41
- Anthony","Jackson, Samuel L.","Jones, James Earl","Knoll, John","Lee, Christopher","Lucas,
42
- George","McDiarmid, Ian","McGregor, Ewan","Oz, Frank","Portman, Natalie","Smits,
43
- Jimmy","Spence, Paul","Steen, Suzie","Yamaguchi, Masa","de Souza Correa, Caroline"],"director":["Lucas,
44
- George"],"text_relevance":["266"],"title":["Star Wars: Episode III - Revenge
45
- of the Sith"],"year":["2005"]}}]},"info":{"rid":"d1b8bf24ec64151ef1900a937725719e16ef82997926220f8d083b43777b29a1e52ffa47d7196049","time-ms":3,"cpu-time-ms":0}}'
38
+ encoding: ASCII-8BIT
39
+ string: !binary |-
40
+ eyJyYW5rIjoiLXRleHRfcmVsZXZhbmNlIiwibWF0Y2gtZXhwciI6IihsYWJl
41
+ bCAnc3RhciB3YXJzJykiLCJoaXRzIjp7ImZvdW5kIjo3LCJzdGFydCI6NCwi
42
+ aGl0IjpbeyJpZCI6InR0MDEyMDkxNSIsImRhdGEiOnsiYWN0b3IiOlsiQXJt
43
+ aXRhZ2UsIFJpY2hhcmQiLCJBdWd1c3QsIFBlcm5pbGxhIiwiQmVzdCwgQWht
44
+ ZWQiLCJCdXJ0dCw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mzc3MjU3MTllYmY5YzcyMDBk
77
+ MTFiOTUyNzk1OGQxZGI4NjE0MDgxZGY5ODA2OGRjYjgyYWJkNjE2IiwidGlt
78
+ ZS1tcyI6MywiY3B1LXRpbWUtbXMiOjB9fQ==
46
79
  http_version:
47
- recorded_at: Fri, 19 Oct 2012 12:54:31 GMT
80
+ recorded_at: Wed, 24 Oct 2012 11:55:46 GMT
48
81
  recorded_with: VCR 2.2.4
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloud_search
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-23 00:00:00.000000000 Z
12
+ date: 2012-10-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: pry
@@ -177,7 +177,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
177
177
  version: '0'
178
178
  segments:
179
179
  - 0
180
- hash: 3335383959573694951
180
+ hash: 2007370367070301926
181
181
  required_rubygems_version: !ruby/object:Gem::Requirement
182
182
  none: false
183
183
  requirements:
@@ -186,7 +186,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
186
186
  version: '0'
187
187
  segments:
188
188
  - 0
189
- hash: 3335383959573694951
189
+ hash: 2007370367070301926
190
190
  requirements: []
191
191
  rubyforge_project:
192
192
  rubygems_version: 1.8.24