elasticsearch-ruby 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.rvmrc +1 -0
- data/elastic_search.gemspec +0 -1
- data/lib/elastic_search/response.rb +1 -1
- data/lib/elastic_search/transport/http.rb +19 -7
- data/lib/elastic_search/version.rb +1 -1
- metadata +13 -23
data/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm ruby-1.9.3@elasticsearch-ruby
|
data/elastic_search.gemspec
CHANGED
@@ -1,18 +1,30 @@
|
|
1
|
-
require
|
1
|
+
require "net/http"
|
2
|
+
require "uri"
|
2
3
|
|
3
4
|
module ElasticSearch
|
4
5
|
class HTTPTransport < TransportBase
|
5
6
|
def execute(request)
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
ElasticSearch::Response.new(body: response.body, status: response.
|
7
|
+
query_string = "?#{request.parameters.to_query}" if request.parameters.is_a?(Hash)
|
8
|
+
http_request = get_class(request.method).new("#{request.path}#{query_string}")
|
9
|
+
http_request.body = request.body
|
10
|
+
response = current_connection.request(http_request)
|
11
|
+
ElasticSearch::Response.new(body: response.body, status: response.code)
|
11
12
|
end
|
12
13
|
|
13
14
|
private
|
14
15
|
def get_connection(host)
|
15
|
-
|
16
|
+
uri = URI.parse(host)
|
17
|
+
Net::HTTP.new(uri.host, uri.port)
|
18
|
+
end
|
19
|
+
|
20
|
+
def get_class(method)
|
21
|
+
case method
|
22
|
+
when :get then Net::HTTP::Get
|
23
|
+
when :post then Net::HTTP::Post
|
24
|
+
when :put then Net::HTTP::Put
|
25
|
+
when :delete then Net::HTTP::Delete
|
26
|
+
when :head then Net::HTTP::Head
|
27
|
+
end
|
16
28
|
end
|
17
29
|
end
|
18
30
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: elasticsearch-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-04-
|
12
|
+
date: 2012-04-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thrift
|
16
|
-
requirement: &
|
16
|
+
requirement: &70256836637740 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,21 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
25
|
-
- !ruby/object:Gem::Dependency
|
26
|
-
name: faraday
|
27
|
-
requirement: &70333353078860 !ruby/object:Gem::Requirement
|
28
|
-
none: false
|
29
|
-
requirements:
|
30
|
-
- - ! '>='
|
31
|
-
- !ruby/object:Gem::Version
|
32
|
-
version: '0'
|
33
|
-
type: :runtime
|
34
|
-
prerelease: false
|
35
|
-
version_requirements: *70333353078860
|
24
|
+
version_requirements: *70256836637740
|
36
25
|
- !ruby/object:Gem::Dependency
|
37
26
|
name: activesupport
|
38
|
-
requirement: &
|
27
|
+
requirement: &70256836637220 !ruby/object:Gem::Requirement
|
39
28
|
none: false
|
40
29
|
requirements:
|
41
30
|
- - ! '>='
|
@@ -43,10 +32,10 @@ dependencies:
|
|
43
32
|
version: 3.0.0
|
44
33
|
type: :runtime
|
45
34
|
prerelease: false
|
46
|
-
version_requirements: *
|
35
|
+
version_requirements: *70256836637220
|
47
36
|
- !ruby/object:Gem::Dependency
|
48
37
|
name: rake
|
49
|
-
requirement: &
|
38
|
+
requirement: &70256836636740 !ruby/object:Gem::Requirement
|
50
39
|
none: false
|
51
40
|
requirements:
|
52
41
|
- - ! '>='
|
@@ -54,10 +43,10 @@ dependencies:
|
|
54
43
|
version: '0'
|
55
44
|
type: :development
|
56
45
|
prerelease: false
|
57
|
-
version_requirements: *
|
46
|
+
version_requirements: *70256836636740
|
58
47
|
- !ruby/object:Gem::Dependency
|
59
48
|
name: minitest
|
60
|
-
requirement: &
|
49
|
+
requirement: &70256836636060 !ruby/object:Gem::Requirement
|
61
50
|
none: false
|
62
51
|
requirements:
|
63
52
|
- - ! '>='
|
@@ -65,10 +54,10 @@ dependencies:
|
|
65
54
|
version: '0'
|
66
55
|
type: :development
|
67
56
|
prerelease: false
|
68
|
-
version_requirements: *
|
57
|
+
version_requirements: *70256836636060
|
69
58
|
- !ruby/object:Gem::Dependency
|
70
59
|
name: turn
|
71
|
-
requirement: &
|
60
|
+
requirement: &70256836635620 !ruby/object:Gem::Requirement
|
72
61
|
none: false
|
73
62
|
requirements:
|
74
63
|
- - ! '>='
|
@@ -76,7 +65,7 @@ dependencies:
|
|
76
65
|
version: '0'
|
77
66
|
type: :development
|
78
67
|
prerelease: false
|
79
|
-
version_requirements: *
|
68
|
+
version_requirements: *70256836635620
|
80
69
|
description: Ruby Driver for Elastic Search
|
81
70
|
email:
|
82
71
|
- edmund@edmundatwork.com
|
@@ -85,6 +74,7 @@ extensions: []
|
|
85
74
|
extra_rdoc_files: []
|
86
75
|
files:
|
87
76
|
- .gitignore
|
77
|
+
- .rvmrc
|
88
78
|
- Gemfile
|
89
79
|
- Rakefile
|
90
80
|
- elastic_search.gemspec
|