Class: CabbageDoc::Response
- Inherits:
-
Object
- Object
- CabbageDoc::Response
- Defined in:
- lib/cabbage_doc/response.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(url, params, response) ⇒ Response
constructor
A new instance of Response.
- #to_json ⇒ Object
Constructor Details
#initialize(url, params, response) ⇒ Response
Returns a new instance of Response.
5 6 7 8 9 10 11 |
# File 'lib/cabbage_doc/response.rb', line 5 def initialize(url, params, response) @url = url @params = params @headers = convert_headers(response) @code = response.code @body = response.parsed_response end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
3 4 5 |
# File 'lib/cabbage_doc/response.rb', line 3 def body @body end |
#code ⇒ Object (readonly)
Returns the value of attribute code.
3 4 5 |
# File 'lib/cabbage_doc/response.rb', line 3 def code @code end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
3 4 5 |
# File 'lib/cabbage_doc/response.rb', line 3 def headers @headers end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
3 4 5 |
# File 'lib/cabbage_doc/response.rb', line 3 def params @params end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
3 4 5 |
# File 'lib/cabbage_doc/response.rb', line 3 def url @url end |
Instance Method Details
#to_json ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/cabbage_doc/response.rb', line 13 def to_json { url: url, query: params.to_query, code: code, headers: prettify(headers), body: prettify(body) }.to_json end |