Class: Azure::Core::Http::HttpResponse::MockResponse
- Inherits:
-
Object
- Object
- Azure::Core::Http::HttpResponse::MockResponse
- 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
-
#body ⇒ Object
Returns the value of attribute body.
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#status ⇒ Object
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(code, body, headers) ⇒ MockResponse
constructor
A new instance of MockResponse.
- #to_hash ⇒ Object
Constructor Details
#initialize(code, body, headers) ⇒ MockResponse
Returns a new instance of MockResponse.
77 78 79 80 81 82 83 84 |
# File 'lib/azure/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
#body ⇒ Object
Returns the value of attribute body.
86 87 88 |
# File 'lib/azure/core/http/http_response.rb', line 86 def body @body end |
#headers ⇒ Object
Returns the value of attribute headers.
87 88 89 |
# File 'lib/azure/core/http/http_response.rb', line 87 def headers @headers end |
#status ⇒ Object
Returns the value of attribute status.
85 86 87 |
# File 'lib/azure/core/http/http_response.rb', line 85 def status @status end |
Instance Method Details
#to_hash ⇒ Object
89 90 91 |
# File 'lib/azure/core/http/http_response.rb', line 89 def to_hash @headers end |