Class: Loggie::Request

Inherits:
Object
  • Object
show all
Includes:
Logging
Defined in:
lib/loggie/request.rb

Overview

Makes external HTTP request, with a retry mechanism for polling long running queries on remote server

Instance Method Summary collapse

Methods included from Logging

included, logger, #logger, logger=

Constructor Details

#initialize(retry_mechanism:) ⇒ Request



10
11
12
# File 'lib/loggie/request.rb', line 10

def initialize(retry_mechanism: )
  @retry_mechanism = retry_mechanism || Retry.new
end

Instance Method Details

#call(url, method: :get, options: nil) ⇒ Object



14
15
16
17
18
# File 'lib/loggie/request.rb', line 14

def call(url, method: :get, options: nil)
  retry_mechanism.call(url, method, options) do |url, method, options|
    request(url, method: method, options: options)
  end
end