Class: NetHTTP::Response
- Inherits:
-
Object
- Object
- NetHTTP::Response
- Defined in:
- lib/response/response.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
(also: #resp_body, #response_body)
Returns the value of attribute body.
-
#body_obj ⇒ Object
(also: #resp_body_obj, #response_body_obj)
Returns the value of attribute body_obj.
-
#body_os ⇒ Object
(also: #resp_body_os, #response_body_os, #body_open_struct, #resp_body_open_struct, #response_body_open_struct)
Returns the value of attribute body_os.
-
#code ⇒ Object
(also: #resp_code, #response_code)
Returns the value of attribute code.
-
#headers ⇒ Object
(also: #resp_headers, #response_headers)
Returns the value of attribute headers.
-
#headers_hash ⇒ Object
(also: #resp_headers_hash, #response_headers_hash)
Returns the value of attribute headers_hash.
-
#headers_os ⇒ Object
(also: #resp_headers_os, #response_headers_os, #headers_open_struct, #resp_headers_struct, #response_headers_open_struct)
Returns the value of attribute headers_os.
- #logger ⇒ Object writeonly
- #response ⇒ Object writeonly
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ Response
constructor
A new instance of Response.
- #log_response ⇒ Object
- #valid_html? ⇒ Boolean
- #valid_json? ⇒ Boolean
- #valid_xml? ⇒ Boolean
Constructor Details
#initialize(opts = {}) ⇒ Response
Returns a new instance of Response.
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/response/response.rb', line 21 def initialize(opts = {}) send('logger=', opts[:logger]) @response = opts[:response] send('response=', opts[:response]) send('code=') send('headers=') send('headers_hash=') send('headers_os=') send('body=') send('body_obj=') send('body_os=') log_response end |
Instance Attribute Details
#body ⇒ Object Also known as: resp_body, response_body
Returns the value of attribute body.
11 12 13 |
# File 'lib/response/response.rb', line 11 def body @body end |
#body_obj ⇒ Object Also known as: resp_body_obj, response_body_obj
Returns the value of attribute body_obj.
11 12 13 |
# File 'lib/response/response.rb', line 11 def body_obj @body_obj end |
#body_os ⇒ Object Also known as: resp_body_os, response_body_os, body_open_struct, resp_body_open_struct, response_body_open_struct
Returns the value of attribute body_os.
11 12 13 |
# File 'lib/response/response.rb', line 11 def body_os @body_os end |
#code ⇒ Object Also known as: resp_code, response_code
Returns the value of attribute code.
11 12 13 |
# File 'lib/response/response.rb', line 11 def code @code end |
#headers ⇒ Object Also known as: resp_headers, response_headers
Returns the value of attribute headers.
11 12 13 |
# File 'lib/response/response.rb', line 11 def headers @headers end |
#headers_hash ⇒ Object Also known as: resp_headers_hash, response_headers_hash
Returns the value of attribute headers_hash.
11 12 13 |
# File 'lib/response/response.rb', line 11 def headers_hash @headers_hash end |
#headers_os ⇒ Object Also known as: resp_headers_os, response_headers_os, headers_open_struct, resp_headers_struct, response_headers_open_struct
Returns the value of attribute headers_os.
11 12 13 |
# File 'lib/response/response.rb', line 11 def headers_os @headers_os end |
#logger=(logger = nil) ⇒ Object
135 136 137 |
# File 'lib/response/response.rb', line 135 def logger=(logger = nil) @logger = Core.get_logger(logger) end |
#response=(response) ⇒ Object
116 117 118 |
# File 'lib/response/response.rb', line 116 def response=(response) @response = response end |
Instance Method Details
#log_response ⇒ Object
139 140 141 142 143 144 145 |
# File 'lib/response/response.rb', line 139 def log_response logger.debug('Response Code => ' + code) logger.debug('Response Headers => ') logger.debug(headers) logger.debug('Response Body => ') logger.debug(body) end |
#valid_html? ⇒ Boolean
128 129 130 |
# File 'lib/response/response.rb', line 128 def valid_html? NetHTTP::Core::Utilities.valid_html?(body, logger) end |
#valid_json? ⇒ Boolean
120 121 122 |
# File 'lib/response/response.rb', line 120 def valid_json? NetHTTP::Core::Utilities.valid_json?(body, logger) end |
#valid_xml? ⇒ Boolean
124 125 126 |
# File 'lib/response/response.rb', line 124 def valid_xml? NetHTTP::Core::Utilities.valid_xml?(body, logger) end |