class RestClient::MockNetHTTPResponse

A class that mocks the behaviour of a Net::HTTPResponse class. It is required since RestClient::Response must be initialized with a class that responds to :code and :to_hash.

Attributes

body[R]
code[R]
header[R]
status[R]

Public Class Methods

new(body, status, header) click to toggle source
# File lib/restclient/components.rb, line 174
def initialize(body, status, header)
  @body = body
  @status = status
  @header = header
end

Public Instance Methods

to_hash() click to toggle source
# File lib/restclient/components.rb, line 180
def to_hash
  @header.inject({}) {|out, (key, value)|
    # In Net::HTTP, header values are arrays
    out[key] = [value]
    out
  }
end