esnek 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -13,8 +13,8 @@ For the installation of elasticsearch please follow the guides at http://www.ela
13
13
  == Usage:
14
14
 
15
15
  require 'esnek'
16
- es = ElasticSearch.new('http://localhost:9200')
17
- es._cluster.state
16
+ es = Esnek.new('http://localhost:9200')
17
+ es._cluster.state.get
18
18
 
19
19
  == Notes
20
20
 
data/lib/esnek/base.rb CHANGED
@@ -11,12 +11,12 @@ class Esnek
11
11
 
12
12
  def method_missing(method_sym, *args, &block)
13
13
  if [:get, :put, :post, :delete].include?(method_sym)
14
- url = @url_root + @chain.map{|e| e[:met]}.join('/')
15
- params = @chain.inject({}){|s,e| s.merge!(e[:params]) if e[:params].is_a?(Hash)}
14
+ url = @url_root.gsub(/\/$/,'') + '/' + @chain.map{|e| e[:method]}.join('/')
15
+ params = @chain.inject({}){|s,e| s.merge!(e[:arg][:params] || {}) if e[:arg].is_a?(Hash)}
16
16
  @chain = []
17
- OpenStruct.new JSON.parse RestClient.send(method_sym, url, {:params => {:q => 'search'}})
17
+ OpenStruct.new JSON.parse RestClient.send(method_sym, url, {:params => params})
18
18
  else
19
- @chain << {:met => method_sym, :params => args}
19
+ @chain << {:method => method_sym, :arg => args[0] || {} }
20
20
  self
21
21
  end
22
22
  end
data/lib/esnek/version.rb CHANGED
@@ -1 +1 @@
1
- ESNEK_VERSION='0.1.0'
1
+ ESNEK_VERSION='0.1.1'
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: esnek
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 0
10
- version: 0.1.0
9
+ - 1
10
+ version: 0.1.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Alper Akgun