Skip to content

Commit 1ef39d7

Browse files
committed
[Gem] Adds attr_accessor to transport in Client
1 parent 82839ee commit 1ef39d7

File tree

5 files changed

+10
-3
lines changed

5 files changed

+10
-3
lines changed

elasticsearch-transport/lib/elasticsearch/transport/client.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ module Transport
2626
#
2727
class Client
2828
include MetaHeader
29-
DEFAULT_TRANSPORT_CLASS = Transport::HTTP::Faraday
29+
DEFAULT_TRANSPORT_CLASS = Transport::HTTP::Faraday
3030

3131
DEFAULT_LOGGER = lambda do
3232
require 'logger'

elasticsearch-transport/lib/elasticsearch/transport/transport/http/faraday.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ module Elasticsearch
1919
module Transport
2020
module Transport
2121
module HTTP
22-
2322
# The default transport implementation, using the [_Faraday_](https://rubygems.org/gems/faraday)
2423
# library for abstracting the HTTP client.
2524
#

elasticsearch/lib/elasticsearch.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ module Elasticsearch
2626

2727
class Client
2828
include Elasticsearch::API
29+
attr_accessor :transport
2930

31+
# See Elasticsearch::Transport::Client for initializer parameters
3032
def initialize(arguments = {}, &block)
3133
@verified = false
3234
@transport = Elasticsearch::Transport::Client.new(arguments, &block)

elasticsearch/spec/integration/client_integration_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050

5151
context 'Reports the right meta header' do
5252
it 'Reports es service name and gem version' do
53-
headers = client.transport.connections.first.connection.headers
53+
headers = client.transport.transport.connections.first.connection.headers
5454
expect(headers['x-elastic-client-meta']).to match /^es=#{Elasticsearch::VERSION}/
5555
end
5656
end

elasticsearch/spec/unit/wrapper_gem_spec.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,10 @@
3030
expect(client).to respond_to(:cluster)
3131
expect(client).to respond_to(:indices)
3232
end
33+
34+
it 'can access the client transport' do
35+
client = Elasticsearch::Client.new
36+
expect(client.transport).to be_a(Elasticsearch::Transport::Client)
37+
expect(client.transport.transport).to be_a(Elasticsearch::Transport::Transport::HTTP::Faraday)
38+
end
3339
end

0 commit comments

Comments
 (0)