class Rubhttp::Response
Attributes
body[R]
@return [Body]
headers[R]
@return [Headers]
status[R]
@return [Status]
Public Class Methods
new(options)
click to toggle source
@option options [Integer] :status @option options [Hash] :headers @option options [String] :body
# File lib/rubhttp/response.rb, line 22 def initialize(options) status = options.fetch(:status) headers = options[:headers] || {} body = options[:body] || '' @status = build_response_status(status) @headers = build_response_headers(headers) @body = build_response_body(body) end
Private Instance Methods
build_response_body(body)
click to toggle source
# File lib/rubhttp/response.rb, line 44 def build_response_body(body) Body.new(body) end
build_response_headers(headers)
click to toggle source
# File lib/rubhttp/response.rb, line 38 def build_response_headers(headers) response_headers = Headers.new headers.each { |k, v| response_headers[k] = v } response_headers end
build_response_status(status)
click to toggle source
# File lib/rubhttp/response.rb, line 34 def build_response_status(status) Status.new(status) end