Class: LAA::FeeCalculator::Connection
- Inherits:
-
Object
- Object
- LAA::FeeCalculator::Connection
- Extended by:
- Forwardable
- Includes:
- Singleton
- Defined in:
- lib/laa/fee_calculator/connection.rb
Instance Attribute Summary collapse
-
#conn ⇒ Object
readonly
Returns the value of attribute conn.
Class Method Summary collapse
Instance Method Summary collapse
- #host ⇒ Object
-
#initialize ⇒ Connection
constructor
A new instance of Connection.
- #ping ⇒ Object
Constructor Details
#initialize ⇒ Connection
Returns a new instance of Connection.
17 18 19 20 21 22 23 |
# File 'lib/laa/fee_calculator/connection.rb', line 17 def initialize @conn = Faraday.new(url: LAA::FeeCalculator.configuration.host, headers: default_headers) do |conn| conn.use LAA::FeeCalculator::RaiseError conn.use(:http_cache, store: cache, logger: logger) if cache conn.adapter :net_http end end |
Instance Attribute Details
#conn ⇒ Object (readonly)
Returns the value of attribute conn.
13 14 15 |
# File 'lib/laa/fee_calculator/connection.rb', line 13 def conn @conn end |
Class Method Details
.host ⇒ Object
26 27 28 |
# File 'lib/laa/fee_calculator/connection.rb', line 26 def host LAA::FeeCalculator.configuration.host end |
Instance Method Details
#host ⇒ Object
31 32 33 |
# File 'lib/laa/fee_calculator/connection.rb', line 31 def host self.class.host end |
#ping ⇒ Object
35 36 37 |
# File 'lib/laa/fee_calculator/connection.rb', line 35 def ping get('/ping.json') end |