module Airborne::RestClientRequester

Public Instance Methods

make_request(*args) click to toggle source
# File lib/airborne_report.rb, line 12
def make_request(*args)
  response = origin_make_request(*args)
  save!(args, response)
  response
rescue SocketError => error
  wasted_save(args, response)
  raise error
end
Also aliased as: origin_make_request
origin_make_request(*args)
Alias for: make_request

Private Instance Methods

full_save(response) click to toggle source
# File lib/airborne_report.rb, line 31
def full_save(response)
  request = response.request
  AirborneReport::Storage::Tests.find_or_create(location)
    .push(AirborneReport::Message.full(request, response).to_hash)
end
location() click to toggle source
# File lib/airborne_report.rb, line 43
def location
  inspect.to_s.split('(').last.split(')').first
end
save!(args, response) click to toggle source
# File lib/airborne_report.rb, line 23
def save!(args, response)
  if response.is_a?(RestClient::Response)
    full_save(response)
  else
    wasted_save(args, response)
  end
end
wasted_save(args, response) click to toggle source
# File lib/airborne_report.rb, line 37
def wasted_save(args, response)
  url = get_url(args[1])
  AirborneReport::Storage::Tests.find_or_create(location)
    .push(AirborneReport::Message.wasted(args, response, url).to_hash)
end