Class: HttpEventstore::Api::Connection
- Inherits:
-
Object
- Object
- HttpEventstore::Api::Connection
- Defined in:
- lib/http_eventstore/api/connection.rb
Constant Summary collapse
- APP_JSON =
'application/json'.freeze
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(endpoint) ⇒ Connection
constructor
A new instance of Connection.
Constructor Details
#initialize(endpoint) ⇒ Connection
Returns a new instance of Connection.
6 7 8 |
# File 'lib/http_eventstore/api/connection.rb', line 6 def initialize(endpoint) @endpoint = endpoint end |
Instance Method Details
#call ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/http_eventstore/api/connection.rb', line 10 def call Faraday.new( url: endpoint.url, headers: { accept: APP_JSON, content_type: APP_JSON } ) do |builder| builder.adapter Faraday.default_adapter builder.response :json, content_type: APP_JSON builder.response :mashify builder.use ErrorsHandler end end |