Class: MoexRuby::FaradayConnection

Inherits:
Object
  • Object
show all
Defined in:
lib/moex_ruby/faraday_connection.rb

Constant Summary collapse

HANDLED_ERRORS =
ErrorHandler.handled_errors.freeze

Instance Method Summary collapse

Constructor Details

#initialize(faraday_connection) ⇒ FaradayConnection

Returns a new instance of FaradayConnection.



10
11
12
# File 'lib/moex_ruby/faraday_connection.rb', line 10

def initialize(faraday_connection)
  @faraday_connection = faraday_connection
end

Instance Method Details

#get(path, params = {}) ⇒ Object



14
15
16
17
18
19
# File 'lib/moex_ruby/faraday_connection.rb', line 14

def get(path, params = {})
  response = @faraday_connection.get(path, params)
  Response.parse(response.body)
rescue *HANDLED_ERRORS => e
  ErrorHandler.handle(e)
end