Sha256: 92b8426bbefab0c067ca50f46bb4a910a5c7b3faf4285e42a23133aebaf82816
Contents?: true
Size: 861 Bytes
Versions: 1
Compression:
Stored size: 861 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 delegate :effective_url, :code, :headers, :options, :mock, :success?, to: :raw # 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 body body_replacement || raw.body end # Provides response time in ms. def time (raw.time || 0) * 1000 end def timeout? raw.timed_out? end def format return JsonFormat.new if request.nil? request.format end private attr_accessor :raw end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
lhc-5.1.0 | lib/lhc/response.rb |