Class: Whoxy::Configuration
- Inherits:
-
Object
- Object
- Whoxy::Configuration
- Defined in:
- lib/whoxy/configuration.rb
Instance Attribute Summary collapse
-
#debug ⇒ Object
Returns the value of attribute debug.
-
#key ⇒ Object
Returns the value of attribute key.
Instance Method Summary collapse
Instance Attribute Details
#debug ⇒ Object
Returns the value of attribute debug.
5 6 7 |
# File 'lib/whoxy/configuration.rb', line 5 def debug @debug end |
#key ⇒ Object
Returns the value of attribute key.
5 6 7 |
# File 'lib/whoxy/configuration.rb', line 5 def key @key end |
Instance Method Details
#connection(&block) ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/whoxy/configuration.rb', line 7 def connection(&block) @connection ||= if block_given? Faraday.new(whoxy_host, &block) else default_connection end end |
#default_connection ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/whoxy/configuration.rb', line 15 def default_connection @connection = Faraday.new(whoxy_host) do |conn| 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 :whoxy, content_type: /\bjson$/ conn.response :logger if debug conn.adapter Faraday.default_adapter end end |