Class: Finicity::Fetchers::Base

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/finicity/fetchers/base.rb

Direct Known Subclasses

API, Token

Class Method Summary collapse

Class Method Details

.request(method, endpoint, opts = {}) ⇒ Object



15
16
17
18
19
20
21
22
23
24
# File 'lib/finicity/fetchers/base.rb', line 15

def request(method, endpoint, opts = {})
  tries = 0
  loop do
    begin
      break fetch(method, endpoint, opts)
    rescue Net::ReadTimeout, Errno::ECONNREFUSED, Net::OpenTimeout => e
      raise e if (tries += 1) > Finicity.configs.max_retries.to_i
    end
  end
end