Class: Azure::Core::Http::HttpResponse::MockResponse

Inherits:
Object
  • Object
show all
Defined in:
lib/azure/core/http/http_response.rb

Overview

TODO: This needs to be deleted and HttpError needs to be refactored to not rely on HttpResponse. The dependency on knowing the internal structure of HttpResponse breaks good design principles. The only reason this class exists is because the HttpError parses the HttpResponse to produce an error msg.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(code, body, headers) ⇒ MockResponse

Returns a new instance of MockResponse.



83
84
85
86
87
88
89
90
# File 'lib/azure/core/http/http_response.rb', line 83

def initialize(code, body, headers)
  @status = code
  @body = body
  @headers = headers
  @headers.each { |k,v|
    @headers[k] = [v] unless v.respond_to? 'first'
  }
end

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



92
93
94
# File 'lib/azure/core/http/http_response.rb', line 92

def body
  @body
end

#headersObject

Returns the value of attribute headers.



93
94
95
# File 'lib/azure/core/http/http_response.rb', line 93

def headers
  @headers
end

#statusObject

Returns the value of attribute status.



91
92
93
# File 'lib/azure/core/http/http_response.rb', line 91

def status
  @status
end

Instance Method Details

#to_hashObject



95
96
97
# File 'lib/azure/core/http/http_response.rb', line 95

def to_hash
  @headers
end