elasticsearch-api 8.5.1 → 8.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9bd26909280a3cbc03ad35a729262ee7c0cf4e274ace5ccc754c334bbb667a9b
4
- data.tar.gz: 5bb02f69dafac974d267266fe6025c0ab83ace5953902a54f2f2e4497cb12b2c
3
+ metadata.gz: 83bd8be41d9f67d39e9cdb030e2ea2286c08bc4fbcdcf23db15a85a533e4f954
4
+ data.tar.gz: d4185c7fca5cb11fce5da43e36ebc44ab27086eb4c62a26541baa5414478fed0
5
5
  SHA512:
6
- metadata.gz: c2e7567c87875abd3d703c240eece417186d177525efdece09cf7ed870d53c7f3e84e2a4faebc116d0f2176ce91cf3be43c1c3a7790f607b7fcd56e5f8fe3400
7
- data.tar.gz: 203af27e5d281b2a72330c17179187b874a87a364484757ed6128aae5b3a80a5b18be06841f0bc3631ab4e17399b39b255b4d2b40989b380c2df231072d40f8a
6
+ metadata.gz: 4dda71b331ae5d4b5aa01a4871cb0495961117332a7f72c8dc96143922402fbaef942c921f950ff373ca5e2a82e2a8ad2a86dc6a27db49ee10be73982ce1cc0a
7
+ data.tar.gz: 3c72b61e3baaacee6abffc54b50da5c0bcda47e3ffd1669f9c0623343294b1025f63de6f13b815a73ccf30a842098b80f9756b2efd0c96ba5fc090f920cd800d
@@ -47,7 +47,7 @@ module Elasticsearch
47
47
 
48
48
  _name = arguments.delete(:name)
49
49
 
50
- method = Elasticsearch::API::HTTP_PUT
50
+ method = _name ? Elasticsearch::API::HTTP_PUT : Elasticsearch::API::HTTP_POST
51
51
  path = if _namespace && _service && _name
52
52
  "_security/service/#{Utils.__listify(_namespace)}/#{Utils.__listify(_service)}/credential/token/#{Utils.__listify(_name)}"
53
53
  else
@@ -17,6 +17,6 @@
17
17
 
18
18
  module Elasticsearch
19
19
  module API
20
- VERSION = '8.5.1'.freeze
20
+ VERSION = '8.5.2'.freeze
21
21
  end
22
22
  end
@@ -18,16 +18,31 @@
18
18
  require 'spec_helper'
19
19
 
20
20
  describe 'client#security#create_service_token' do
21
+ let(:expected_path) { '_security/service/foo/bar/credential/token' }
22
+ let(:expected_request_method) { 'POST' }
21
23
  let(:expected_args) do
22
24
  [
23
- 'PUT',
24
- '_security/service/foo/bar/credential/token',
25
+ expected_request_method,
26
+ expected_path,
25
27
  {},
26
28
  nil,
27
29
  {}
28
30
  ]
29
31
  end
30
32
 
33
+ context 'with token name' do
34
+ let(:expected_request_method) { 'PUT' }
35
+ let(:token_name) { 'test-token' }
36
+ let(:expected_path) { "#{super()}/#{token_name}" }
37
+ it 'performs the request' do
38
+ expect(
39
+ client_double.security.create_service_token(
40
+ namespace: 'foo', service: 'bar', name: token_name
41
+ )
42
+ ).to be_a Elasticsearch::API::Response
43
+ end
44
+ end
45
+
31
46
  it 'performs the request' do
32
47
  expect(
33
48
  client_double.security.create_service_token(
@@ -171,6 +171,7 @@ module Elasticsearch
171
171
 
172
172
  def __http_method
173
173
  return '_id ? Elasticsearch::API::HTTP_PUT : Elasticsearch::API::HTTP_POST' if @endpoint_name == 'index'
174
+ return '_name ? Elasticsearch::API::HTTP_PUT : Elasticsearch::API::HTTP_POST' if @method_name == 'create_service_token'
174
175
  return post_and_get if @endpoint_name == 'count'
175
176
 
176
177
  default_method = @spec['url']['paths'].map { |a| a['methods'] }.flatten.first
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: 8.5.1
4
+ version: 8.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karel Minarik
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-11-15 00:00:00.000000000 Z
11
+ date: 2022-11-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: multi_json