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

Inherits:
Object
  • Object
show all
Defined in:
lib/azure/storage/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


77
78
79
80
81
82
83
84
# File 'lib/azure/storage/core/http/http_response.rb', line 77

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


86
87
88
# File 'lib/azure/storage/core/http/http_response.rb', line 86

def body
  @body
end

#headersObject

Returns the value of attribute headers


87
88
89
# File 'lib/azure/storage/core/http/http_response.rb', line 87

def headers
  @headers
end

#statusObject

Returns the value of attribute status


85
86
87
# File 'lib/azure/storage/core/http/http_response.rb', line 85

def status
  @status
end

Instance Method Details

#to_hashObject


89
90
91
# File 'lib/azure/storage/core/http/http_response.rb', line 89

def to_hash
  @headers
end