/usr/lib/ruby/vendor_ruby/typhoeus/response.rb is in ruby-typhoeus 0.6.3-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | 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
|