Class: LAA::FeeCalculator::Connection

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
Singleton
Defined in:
lib/laa/fee_calculator/connection.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConnection

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

#connObject (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

.hostObject



26
27
28
# File 'lib/laa/fee_calculator/connection.rb', line 26

def host
  LAA::FeeCalculator.configuration.host
end

Instance Method Details

#hostObject



31
32
33
# File 'lib/laa/fee_calculator/connection.rb', line 31

def host
  self.class.host
end

#pingObject



35
36
37
# File 'lib/laa/fee_calculator/connection.rb', line 35

def ping
  get('/ping.json')
end