elasticsearch-api 1.0.11 → 1.0.12

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 809bad690b19674236f2947c0199b6b5c5a56cef
4
- data.tar.gz: 84b3250f0b22bdc58974d8216ec239a28dfa6fd6
3
+ metadata.gz: 62247808bb72f7ae656b190ea047eeb8a93160f2
4
+ data.tar.gz: 0ab2745690ffc9e0e5243b050ade10dea4fec177
5
5
  SHA512:
6
- metadata.gz: 1c612ec40fbac63d3b845ab1e1d4963fed7e501bfe42d1a5476159f2d08aa388e25302dca5a6a0e517e41a84a4eff1fea341d5a04bfb7fbcc8c3eefc94c53ce0
7
- data.tar.gz: f623a29d97eba9852fdc5532a1deba497c21fdac7fc36c3852df3e6a8884af1a8c3a92603ec81310aa395b020c7b7c3ca523eadb21248da3a66ebfb1743edb0d
6
+ metadata.gz: 04845dd1ec5918fdd884ced7eed2772f15e3e73b56462d8e4859964e55a099af166dd9cf7df5715141aa69a286fbdb91bbe7360f4133d60b9f38953e86e0c1b5
7
+ data.tar.gz: 4e0f8f9f1e1d4853d48acc0f583af99b8d84693af566e18eb8f775fc0e3b0b1e731964a54bf40391d9d5b24f784a093f25efc5be593bfb637a70722530893130
@@ -51,7 +51,9 @@ module Elasticsearch
51
51
  params = Utils.__validate_and_extract_params arguments, valid_params
52
52
  body = nil
53
53
 
54
- Utils.__rescue_from_not_found do
54
+ if Array(arguments[:ignore]).include?(404)
55
+ Utils.__rescue_from_not_found { perform_request(method, path, params, body).body }
56
+ else
55
57
  perform_request(method, path, params, body).body
56
58
  end
57
59
  end
@@ -61,7 +61,9 @@ module Elasticsearch
61
61
 
62
62
  params[:fields] = Utils.__listify(params[:fields]) if params[:fields]
63
63
 
64
- Utils.__rescue_from_not_found do
64
+ if Array(arguments[:ignore]).include?(404)
65
+ Utils.__rescue_from_not_found { perform_request(method, path, params, body).body }
66
+ else
65
67
  perform_request(method, path, params, body).body
66
68
  end
67
69
  end
@@ -16,7 +16,9 @@ module Elasticsearch
16
16
  params = {}
17
17
  body = arguments[:body]
18
18
 
19
- Utils.__rescue_from_not_found do
19
+ if Array(arguments[:ignore]).include?(404)
20
+ Utils.__rescue_from_not_found { perform_request(method, path, params, body).body }
21
+ else
20
22
  perform_request(method, path, params, body).body
21
23
  end
22
24
  end
@@ -38,7 +38,9 @@ module Elasticsearch
38
38
  params = Utils.__validate_and_extract_params arguments, valid_params
39
39
  body = nil
40
40
 
41
- Utils.__rescue_from_not_found do
41
+ if Array(arguments[:ignore]).include?(404)
42
+ Utils.__rescue_from_not_found { perform_request(method, path, params, body).body }
43
+ else
42
44
  perform_request(method, path, params, body).body
43
45
  end
44
46
  end
@@ -28,7 +28,9 @@ module Elasticsearch
28
28
  params = Utils.__validate_and_extract_params arguments, valid_params
29
29
  body = nil
30
30
 
31
- Utils.__rescue_from_not_found do
31
+ if Array(arguments[:ignore]).include?(404)
32
+ Utils.__rescue_from_not_found { perform_request(method, path, params, body).body }
33
+ else
32
34
  perform_request(method, path, params, body).body
33
35
  end
34
36
  end
@@ -94,7 +94,9 @@ module Elasticsearch
94
94
 
95
95
  params[:fields] = Utils.__listify(params[:fields]) if params[:fields]
96
96
 
97
- Utils.__rescue_from_not_found do
97
+ if Array(arguments[:ignore]).include?(404)
98
+ Utils.__rescue_from_not_found { perform_request(method, path, params, body).body }
99
+ else
98
100
  perform_request(method, path, params, body).body
99
101
  end
100
102
  end
@@ -1,5 +1,5 @@
1
1
  module Elasticsearch
2
2
  module API
3
- VERSION = "1.0.11"
3
+ VERSION = "1.0.12"
4
4
  end
5
5
  end
@@ -62,11 +62,19 @@ module Elasticsearch
62
62
  subject.delete :index => 'foo^bar', :type => 'bar/bam', :id => 1
63
63
  end
64
64
 
65
+ should "raise a NotFound exception" do
66
+ subject.expects(:perform_request).raises(NotFound)
67
+
68
+ assert_raise NotFound do
69
+ subject.delete :index => 'foo', :type => 'bar', :id => 'XXX'
70
+ end
71
+ end
72
+
65
73
  should "catch a NotFound exception with the ignore parameter" do
66
74
  subject.expects(:perform_request).raises(NotFound)
67
75
 
68
76
  assert_nothing_raised do
69
- subject.get :index => 'foo', :type => 'bar', :id => 'XXX', :ignore => 404
77
+ subject.delete :index => 'foo', :type => 'bar', :id => 'XXX', :ignore => 404
70
78
  end
71
79
  end
72
80
 
@@ -62,6 +62,14 @@ module Elasticsearch
62
62
  end
63
63
  end
64
64
 
65
+ should "raise a NotFound exception" do
66
+ subject.expects(:perform_request).raises(NotFound)
67
+
68
+ assert_raise NotFound do
69
+ subject.get :index => 'foo', :type => 'bar', :id => 'XXX'
70
+ end
71
+ end
72
+
65
73
  should "catch a NotFound exception with the ignore parameter" do
66
74
  subject.expects(:perform_request).raises(NotFound)
67
75
 
@@ -19,6 +19,21 @@ module Elasticsearch
19
19
  subject.get_template :id => "foo"
20
20
  end
21
21
 
22
+ should "raise a NotFound exception" do
23
+ subject.expects(:perform_request).raises(NotFound)
24
+
25
+ assert_raise NotFound do
26
+ subject.get_template :id => "foo"
27
+ end
28
+ end
29
+
30
+ should "catch a NotFound exception with the ignore parameter" do
31
+ subject.expects(:perform_request).raises(NotFound)
32
+
33
+ assert_nothing_raised do
34
+ subject.get_template :id => "foo", :ignore => 404
35
+ end
36
+ end
22
37
  end
23
38
 
24
39
  end
@@ -28,11 +28,19 @@ module Elasticsearch
28
28
  subject.indices.delete_template :name => 'foo^bar'
29
29
  end
30
30
 
31
- should "ignore 404s" do
31
+ should "raise a NotFound exception" do
32
+ subject.expects(:perform_request).raises(NotFound)
33
+
34
+ assert_raise NotFound do
35
+ assert ! subject.indices.delete_template(:name => 'foo')
36
+ end
37
+ end
38
+
39
+ should "catch a NotFound exception with the ignore parameter" do
32
40
  subject.expects(:perform_request).raises(NotFound)
33
41
 
34
42
  assert_nothing_raised do
35
- assert ! subject.indices.delete_template(:name => 'foo^bar', :ignore => 404)
43
+ assert ! subject.indices.delete_template(:name => 'foo', :ignore => 404)
36
44
  end
37
45
  end
38
46
 
@@ -47,6 +47,14 @@ module Elasticsearch
47
47
  subject.indices.delete :index => 'foo^bar'
48
48
  end
49
49
 
50
+ should "raise a NotFound exception" do
51
+ subject.expects(:perform_request).raises(NotFound)
52
+
53
+ assert_raise NotFound do
54
+ subject.indices.delete :index => 'foo'
55
+ end
56
+ end
57
+
50
58
  should "catch a NotFound exception with the ignore parameter" do
51
59
  subject.expects(:perform_request).raises(NotFound)
52
60
 
@@ -62,11 +62,19 @@ module Elasticsearch
62
62
  subject.update :index => 'foo^bar', :type => 'bar/bam', :id => '1', :body => {}
63
63
  end
64
64
 
65
+ should "raise a NotFound exception" do
66
+ subject.expects(:perform_request).raises(NotFound)
67
+
68
+ assert_raise NotFound do
69
+ subject.update :index => 'foo', :type => 'bar', :id => 'XXX'
70
+ end
71
+ end
72
+
65
73
  should "catch a NotFound exception with the ignore parameter" do
66
74
  subject.expects(:perform_request).raises(NotFound)
67
75
 
68
76
  assert_nothing_raised do
69
- subject.get :index => 'foo', :type => 'bar', :id => 'XXX', :ignore => 404
77
+ subject.update :index => 'foo', :type => 'bar', :id => 'XXX', :ignore => 404
70
78
  end
71
79
  end
72
80
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elasticsearch-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.11
4
+ version: 1.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karel Minarik
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-05-29 00:00:00.000000000 Z
11
+ date: 2015-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json