Class: PipeLineDealer::Client::Connection
- Inherits:
-
Object
- Object
- PipeLineDealer::Client::Connection
- Defined in:
- lib/pipe_line_dealer/client/connection.rb
Constant Summary collapse
- DEFAULT_OPTIONS =
{ http_debug: false }
Instance Attribute Summary collapse
-
#cache(key, &block) ⇒ Object
Returns the value of attribute cache.
Instance Method Summary collapse
- #build_connection ⇒ Object
-
#initialize(key, options) ⇒ Connection
constructor
A new instance of Connection.
Constructor Details
#initialize(key, options) ⇒ Connection
Returns a new instance of Connection.
10 11 12 13 14 15 |
# File 'lib/pipe_line_dealer/client/connection.rb', line 10 def initialize(key, ) @key = key @cache = {} @options = DEFAULT_OPTIONS.merge @connection = build_connection end |
Instance Attribute Details
#cache(key, &block) ⇒ Object
Returns the value of attribute cache.
4 5 6 |
# File 'lib/pipe_line_dealer/client/connection.rb', line 4 def cache @cache end |
Instance Method Details
#build_connection ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/pipe_line_dealer/client/connection.rb', line 17 def build_connection Faraday.new(url: ENDPOINT) do |faraday| faraday.request :url_encoded faraday.response :logger if @options[:http_debug] faraday.adapter Faraday.default_adapter end end |