Class: Reactio::FaradayEngine
- Inherits:
-
Faraday::Middleware
- Object
- Faraday::Middleware
- Reactio::FaradayEngine
- Defined in:
- lib/reactio/faraday_engine.rb
Constant Summary collapse
- USER_AGENT =
"Reactio ruby v#{VERSION}".freeze
- MIME_TYPE =
'application/json'.freeze
Instance Method Summary collapse
- #call(request_env) ⇒ Object
-
#initialize(app, api_key) ⇒ FaradayEngine
constructor
A new instance of FaradayEngine.
Constructor Details
#initialize(app, api_key) ⇒ FaradayEngine
Returns a new instance of FaradayEngine.
9 10 11 12 |
# File 'lib/reactio/faraday_engine.rb', line 9 def initialize(app, api_key) super(app) @api_key = api_key end |
Instance Method Details
#call(request_env) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/reactio/faraday_engine.rb', line 14 def call(request_env) set_request_header(request_env) encode_body(request_env) @app.call(request_env).on_complete do |response_env| decode_body(response_env) end end |