Sha256: e1fd6a10ac2687c3568d5dddbab42d603bff46c76397bd3823e149d176a34fff
Contents?: true
Size: 1.52 KB
Versions: 3
Compression:
Stored size: 1.52 KB
Contents
require 'typhoeus/response/header' require 'typhoeus/response/informations' require 'typhoeus/response/status' module Typhoeus # This class represents the response. class Response include Response::Informations include Response::Status # Remembers the corresponding request. # # @example Get request. # request = Typhoeus::Request.get("www.example.com") # response = request.run # request == response.request # #=> true # # @return [ Typhoeus::Request ] attr_accessor :request # The provided options, which contain all the # informations about the request. # # @return [ Hash ] attr_accessor :options # Set the handled response. attr_writer :handled_response # @api private attr_writer :mock # Create a new response. # # @example Create a response. # Response.new # # @param [ Hash ] options The options hash. # # @return [ Response ] The new response. def initialize(options = {}) @options = options @headers = Header.new(options[:headers]) if options[:headers] end # Returns whether this request is mocked # or not. # # @api private def mock defined?(@mock) ? @mock : options[:mock] end # Returns the handled_response if it has # been defined; otherwise, returns the response # # @return [ Object ] The result of callbacks # done on the response or the original response. def handled_response @handled_response || self end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
typhoeus-0.6.5 | lib/typhoeus/response.rb |
typhoeus-0.6.4 | lib/typhoeus/response.rb |
typhoeus-0.6.3 | lib/typhoeus/response.rb |