Class: EventStoreClient::HTTP::Connection

Inherits:
Object
  • Object
show all
Includes:
Configuration
Defined in:
lib/event_store_client/adapters/http/connection.rb

Instance Method Summary collapse

Methods included from Configuration

#config

Instance Method Details

#call(method_name, path, body: {}, headers: {}) ⇒ Object



11
12
13
14
15
16
17
18
# File 'lib/event_store_client/adapters/http/connection.rb', line 11

def call(method_name, path, body: {}, headers: {})
  method = RequestMethod.new(method_name)
  connection.send(method.to_s, path) do |req|
    req.headers = req.headers.merge(headers)
    req.body = body.is_a?(String) ? body : body.to_json
    req.params['embed'] = 'body' if method == :get
  end
end