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.



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

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

.hostObject



23
24
25
# File 'lib/laa/fee_calculator/connection.rb', line 23

def host
  LAA::FeeCalculator.configuration.host
end

Instance Method Details

#hostObject



28
29
30
# File 'lib/laa/fee_calculator/connection.rb', line 28

def host
  self.class.host
end

#pingObject



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

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