Class: HttpEventStore::Api::Connection
- Inherits:
-
Object
- Object
- HttpEventStore::Api::Connection
- Defined in:
- lib/http_event_store/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_event_store/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 |
# File 'lib/http_event_store/api/connection.rb', line 10 def call Faraday.new( url: endpoint.url, ) do |builder| builder.request :retry, max: 4, interval: 0.05, interval_randomness: 0.5, backoff_factor: 2 builder.adapter Faraday.default_adapter builder.response :json, content_type: APP_JSON builder.response :mashify builder.use ErrorsHandler end end |