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.
15 16 17 18 19 20 |
# File 'lib/laa/fee_calculator/connection.rb', line 15 def initialize @conn = Faraday.new(url: LAA::FeeCalculator.configuration.host, headers: default_headers) do |conn| conn.use LAA::FeeCalculator::RaiseError conn.use Faraday::Adapter::NetHttp end end |
Instance Attribute Details
#conn ⇒ Object (readonly)
Returns the value of attribute conn.
12 13 14 |
# File 'lib/laa/fee_calculator/connection.rb', line 12 def conn @conn end |
Class Method Details
.host ⇒ Object
23 24 25 |
# File 'lib/laa/fee_calculator/connection.rb', line 23 def host LAA::FeeCalculator.configuration.host end |
Instance Method Details
#host ⇒ Object
28 29 30 |
# File 'lib/laa/fee_calculator/connection.rb', line 28 def host self.class.host end |
#ping ⇒ Object
32 33 34 |
# File 'lib/laa/fee_calculator/connection.rb', line 32 def ping get('/ping.json') end |