Module: Eloquant::Connection
- Included in:
- Client
- Defined in:
- lib/eloquant/concerns/connection.rb
Instance Attribute Summary collapse
-
#connection ⇒ Object
Returns the value of attribute connection.
Instance Method Summary collapse
Instance Attribute Details
#connection ⇒ Object
Returns the value of attribute connection.
5 6 7 |
# File 'lib/eloquant/concerns/connection.rb', line 5 def connection @connection end |
Instance Method Details
#init_connection ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/eloquant/concerns/connection.rb', line 15 def init_connection Faraday.new(url: @host) do |conn| conn.request :multipart conn.request :url_encoded conn.request :retry, max: 10, interval: 0.05, interval_randomness: 0.5, backoff_factor: 2, exceptions: [Errno::ETIMEDOUT, "Timeout::Error", ::Faraday::Error::TimeoutError, ::Faraday::ConnectionFailed] conn.response :logger if @debug conn.response :eloquant, content_type: /\bjson$/ conn..timeout = [:read_timeout] if .key?(:read_timeout) conn..open_timeout = [:open_timeout] if .key?(:open_timeout) conn.adapter Faraday.default_adapter end end |
#reload_connection ⇒ Object
11 12 13 |
# File 'lib/eloquant/concerns/connection.rb', line 11 def reload_connection @connection = init_connection end |