class PasswordBreachAlert::Api::Base

Constants

DEFAULT_REQUEST_OPTIONS

Public Class Methods

new(request_options = {}) click to toggle source
# File lib/password_breach_alert/api/base.rb, line 18
def initialize(request_options = {})
  @request_options = DEFAULT_REQUEST_OPTIONS.merge(request_options)
end

Public Instance Methods

with_wait() { || ... } click to toggle source
# File lib/password_breach_alert/api/base.rb, line 22
def with_wait
  return enum_for :with_wait unless block_given?

  # TODO: with_advisory_lock('PasswordBreachAlert::Api') do
  if last_called_at && last_called_at > SLEEP_DURATION.ago
    sleep(last_called_at - SLEEP_DURATION.ago)
  end

  result = yield

  self.last_called_at = Time.current
  # TODO: end

  result
end