cloud_search 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,40 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: http://doc-imdb-movies-pl6u4t3elu7dhsbwaqbsy3y6be.us-east-1.cloudsearch.amazonaws.com/2011-02-01/documents/batch
6
+ body:
7
+ encoding: UTF-8
8
+ string: ! '[{"type":"add","id":"678","version":5,"lang":"en","fields":{"actor":["Cassio
9
+ Marques","Willian Fernandes"],"director":["Lucas, George"],"title":"Troy Wars"}},{"type":"add","id":"679","version":5,"lang":"en","fields":{"title":"Fight
10
+ Club"}},{"type":"add","id":"680","version":5,"lang":"en","fields":{"title":"Lord
11
+ of the Rings"}}]'
12
+ headers:
13
+ Content-Type:
14
+ - application/json
15
+ response:
16
+ status:
17
+ code: 200
18
+ message: OK
19
+ headers:
20
+ !binary "Q29udGVudC1UeXBl":
21
+ - !binary |-
22
+ YXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOA==
23
+ !binary "RGF0ZQ==":
24
+ - !binary |-
25
+ VHVlLCAxNiBPY3QgMjAxMiAxODoxMjo1NCBHTVQ=
26
+ !binary "U2VydmVy":
27
+ - !binary |-
28
+ U2VydmVy
29
+ !binary "Q29udGVudC1MZW5ndGg=":
30
+ - !binary |-
31
+ NDY=
32
+ !binary "Q29ubmVjdGlvbg==":
33
+ - !binary |-
34
+ Q2xvc2U=
35
+ body:
36
+ encoding: US-ASCII
37
+ string: ! '{"status": "success", "adds": 3, "deletes": 0}'
38
+ http_version:
39
+ recorded_at: Tue, 16 Oct 2012 18:12:58 GMT
40
+ recorded_with: VCR 2.2.5
@@ -0,0 +1,37 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: http://doc-imdb-movies-pl6u4t3elu7dhsbwaqbsy3y6be.us-east-1.cloudsearch.amazonaws.com/2011-02-01/documents/batch
6
+ body:
7
+ encoding: UTF-8
8
+ string: ! '[{"type":"delete","id":"678","version":2}]'
9
+ headers:
10
+ Content-Type:
11
+ - application/json
12
+ response:
13
+ status:
14
+ code: 200
15
+ message: OK
16
+ headers:
17
+ !binary "Q29udGVudC1UeXBl":
18
+ - !binary |-
19
+ YXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOA==
20
+ !binary "RGF0ZQ==":
21
+ - !binary |-
22
+ VHVlLCAxNiBPY3QgMjAxMiAxODowODoxNyBHTVQ=
23
+ !binary "U2VydmVy":
24
+ - !binary |-
25
+ U2VydmVy
26
+ !binary "Q29udGVudC1MZW5ndGg=":
27
+ - !binary |-
28
+ NDY=
29
+ !binary "Q29ubmVjdGlvbg==":
30
+ - !binary |-
31
+ Q2xvc2U=
32
+ body:
33
+ encoding: US-ASCII
34
+ string: ! '{"status": "success", "adds": 0, "deletes": 1}'
35
+ http_version:
36
+ recorded_at: Tue, 16 Oct 2012 18:08:20 GMT
37
+ recorded_with: VCR 2.2.5
data/spec/spec_helper.rb CHANGED
@@ -6,6 +6,11 @@ SimpleCov.start
6
6
 
7
7
  require "cloud_search"
8
8
 
9
+ CloudSearch.configure do |config|
10
+ config.domain_id = "pl6u4t3elu7dhsbwaqbsy3y6be"
11
+ config.domain_name = "imdb-movies"
12
+ end
13
+
9
14
  Dir[File.dirname(__FILE__) + "/support/**/*.rb"].each do |file|
10
15
  require file
11
16
  end
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.0.1
4
+ version: 0.0.2
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-11 00:00:00.000000000 Z
12
+ date: 2012-10-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: pry
@@ -107,6 +107,54 @@ dependencies:
107
107
  - - ! '>='
108
108
  - !ruby/object:Gem::Version
109
109
  version: '0'
110
+ - !ruby/object:Gem::Dependency
111
+ name: guard
112
+ requirement: !ruby/object:Gem::Requirement
113
+ none: false
114
+ requirements:
115
+ - - ! '>='
116
+ - !ruby/object:Gem::Version
117
+ version: '0'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ none: false
122
+ requirements:
123
+ - - ! '>='
124
+ - !ruby/object:Gem::Version
125
+ version: '0'
126
+ - !ruby/object:Gem::Dependency
127
+ name: guard-rspec
128
+ requirement: !ruby/object:Gem::Requirement
129
+ none: false
130
+ requirements:
131
+ - - ! '>='
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
134
+ type: :development
135
+ prerelease: false
136
+ version_requirements: !ruby/object:Gem::Requirement
137
+ none: false
138
+ requirements:
139
+ - - ! '>='
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ - !ruby/object:Gem::Dependency
143
+ name: rb-fsevent
144
+ requirement: !ruby/object:Gem::Requirement
145
+ none: false
146
+ requirements:
147
+ - - ! '>='
148
+ - !ruby/object:Gem::Version
149
+ version: '0'
150
+ type: :development
151
+ prerelease: false
152
+ version_requirements: !ruby/object:Gem::Requirement
153
+ none: false
154
+ requirements:
155
+ - - ! '>='
156
+ - !ruby/object:Gem::Version
157
+ version: '0'
110
158
  - !ruby/object:Gem::Dependency
111
159
  name: em-http-request
112
160
  requirement: !ruby/object:Gem::Requirement
@@ -132,17 +180,31 @@ extra_rdoc_files: []
132
180
  files:
133
181
  - .gitignore
134
182
  - .rspec
183
+ - .travis.yml
135
184
  - Gemfile
185
+ - Guardfile
136
186
  - LICENSE.txt
137
187
  - README.md
138
188
  - Rakefile
139
189
  - cloud_search.gemspec
140
190
  - lib/cloud_search.rb
141
191
  - lib/cloud_search/config.rb
142
- - lib/cloud_search/search.rb
192
+ - lib/cloud_search/document.rb
193
+ - lib/cloud_search/indexer.rb
194
+ - lib/cloud_search/invalid_document.rb
195
+ - lib/cloud_search/search_response.rb
196
+ - lib/cloud_search/searcher.rb
143
197
  - lib/cloud_search/version.rb
144
198
  - spec/cloud_search/config_spec.rb
145
- - spec/cloud_search/search_spec.rb
199
+ - spec/cloud_search/document_spec.rb
200
+ - spec/cloud_search/indexer_spec.rb
201
+ - spec/cloud_search/invalid_document_spec.rb
202
+ - spec/cloud_search/search_response_spec.rb
203
+ - spec/cloud_search/searcher_spec.rb
204
+ - spec/fixtures/full.yml
205
+ - spec/fixtures/vcr_cassettes/index/request/add.yml
206
+ - spec/fixtures/vcr_cassettes/index/request/add_in_batch.yml
207
+ - spec/fixtures/vcr_cassettes/index/request/delete.yml
146
208
  - spec/fixtures/vcr_cassettes/search/request/full.yml
147
209
  - spec/spec_helper.rb
148
210
  - spec/support/vcr.rb
@@ -166,14 +228,21 @@ required_rubygems_version: !ruby/object:Gem::Requirement
166
228
  version: '0'
167
229
  requirements: []
168
230
  rubyforge_project:
169
- rubygems_version: 1.8.23
231
+ rubygems_version: 1.8.24
170
232
  signing_key:
171
233
  specification_version: 3
172
234
  summary: A wraper to Amazon CloudSearch's API
173
235
  test_files:
174
236
  - spec/cloud_search/config_spec.rb
175
- - spec/cloud_search/search_spec.rb
237
+ - spec/cloud_search/document_spec.rb
238
+ - spec/cloud_search/indexer_spec.rb
239
+ - spec/cloud_search/invalid_document_spec.rb
240
+ - spec/cloud_search/search_response_spec.rb
241
+ - spec/cloud_search/searcher_spec.rb
242
+ - spec/fixtures/full.yml
243
+ - spec/fixtures/vcr_cassettes/index/request/add.yml
244
+ - spec/fixtures/vcr_cassettes/index/request/add_in_batch.yml
245
+ - spec/fixtures/vcr_cassettes/index/request/delete.yml
176
246
  - spec/fixtures/vcr_cassettes/search/request/full.yml
177
247
  - spec/spec_helper.rb
178
248
  - spec/support/vcr.rb
179
- has_rdoc:
@@ -1,35 +0,0 @@
1
- require "json"
2
-
3
- module CloudSearch
4
- class Search
5
- def self.request(query, *fields)
6
- response, message = nil
7
-
8
- EM.run do
9
- url = CloudSearch.config.search_url
10
- url+= "/#{CloudSearch.config.api_version}"
11
- url+= "/search"
12
- url+= "?q=#{CGI.escape(query)}"
13
- url+= "&return-fields=#{CGI.escape(fields.join(","))}" if fields.any?
14
-
15
- http = EM::HttpRequest.new(url).get
16
-
17
- http.callback {
18
- message = "#{http.response_header.status} - #{http.response.length} bytes\n#{url}\n"
19
- response = JSON.parse(http.response)
20
-
21
- EM.stop
22
- }
23
-
24
- http.errback {
25
- message = "#{url}\n#{http.error}"
26
-
27
- EM.stop
28
- }
29
- end
30
-
31
- [response, message]
32
- end
33
- end
34
- end
35
-
@@ -1,39 +0,0 @@
1
- require "spec_helper"
2
-
3
- describe CloudSearch::Search do
4
- subject { CloudSearch::Search }
5
-
6
- before do
7
- CloudSearch.configure do |config|
8
- config.domain_id = "pl6u4t3elu7dhsbwaqbsy3y6be"
9
- config.domain_name = "imdb-movies"
10
- end
11
- end
12
-
13
- describe ".request" do
14
- let(:fields) { [:actor, :director, :title, :year, :text_relevance] }
15
-
16
- context "given valid parameters" do
17
- it "returns http 200 code" do
18
- VCR.use_cassette("search/request/full") do
19
- resp, msg = subject.request("star wars", *fields)
20
- expect(msg).to match(/^200/)
21
- end
22
- end
23
-
24
- it "returns one or more results" do
25
- VCR.use_cassette("search/request/full") do
26
- resp, msg = subject.request("star wars", *fields)
27
- expect(resp["hits"]["found"]).to be >= 1
28
- end
29
- end
30
- end
31
-
32
- context "given invalid parameters" do
33
- it "returns" do
34
-
35
- end
36
- end
37
- end
38
- end
39
-