Sha256: d6792061dcdc5713d453c4385226ce5a1a08ccaf579781ee6e99aaaef4e54be7
Contents?: true
Size: 972 Bytes
Versions: 6
Compression:
Stored size: 972 Bytes
Contents
require 'typhoeus' # The response contains the raw response (typhoeus) # and provides functionality to access response data. class LHC::Response attr_accessor :request, :body_replacement # A response is initalized with the underlying raw response (typhoeus in our case) # and the associated request. def initialize(raw, request) self.request = request self.raw = raw end def data @data ||= LHC::Response::Data.new(self) end def [](key) data[key] end def effective_url raw.effective_url end def body body_replacement || raw.body end def code raw.code end def headers raw.headers end def options raw.options end # Provides response time in ms. def time (raw.time || 0) * 1000 end def timeout? raw.timed_out? end def success? raw.success? end def format return JsonFormat.new if request.nil? request.format end private attr_accessor :raw end
Version data entries
6 entries across 6 versions & 1 rubygems
Version | Path |
---|---|
lhc-5.0.0 | lib/lhc/response.rb |
lhc-4.0.2 | lib/lhc/response.rb |
lhc-4.0.1 | lib/lhc/response.rb |
lhc-4.0.0 | lib/lhc/response.rb |
lhc-3.8.1 | lib/lhc/response.rb |
lhc-3.8.0 | lib/lhc/response.rb |