Class: FileStore::WebDAV::ResponseHeaders
- Inherits:
-
Object
- Object
- FileStore::WebDAV::ResponseHeaders
- Defined in:
- lib/filestore/webdav/webdav.rb
Overview
Class implementing easy accessor to HTTP response headers
Instance Attribute Summary collapse
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#http_version ⇒ Object
readonly
Returns the value of attribute http_version.
-
#response_text ⇒ Object
readonly
Returns the value of attribute response_text.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(text) ⇒ ResponseHeaders
constructor
Initialize new ResponseHeaders instance.
-
#is_html? ⇒ Boolean
Determines wether the reponse body is HTML.
-
#is_xml? ⇒ Boolean
Determines wether the reponse body is XML.
Constructor Details
#initialize(text) ⇒ ResponseHeaders
Initialize new ResponseHeaders instance
Arguments:
text: The raw response text
25 26 27 28 29 30 31 32 |
# File 'lib/filestore/webdav/webdav.rb', line 25 def initialize(text) @headers = {} @http_version = '' @status = -1 @response_text = '' parse text end |
Instance Attribute Details
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
18 19 20 |
# File 'lib/filestore/webdav/webdav.rb', line 18 def headers @headers end |
#http_version ⇒ Object (readonly)
Returns the value of attribute http_version.
18 19 20 |
# File 'lib/filestore/webdav/webdav.rb', line 18 def http_version @http_version end |
#response_text ⇒ Object (readonly)
Returns the value of attribute response_text.
18 19 20 |
# File 'lib/filestore/webdav/webdav.rb', line 18 def response_text @response_text end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
18 19 20 |
# File 'lib/filestore/webdav/webdav.rb', line 18 def status @status end |
Instance Method Details
#is_html? ⇒ Boolean
Determines wether the reponse body is HTML
Returns:
true if content type is appilcation/html, false otherwise
48 49 50 |
# File 'lib/filestore/webdav/webdav.rb', line 48 def is_html? not (@headers['Content-Type'] =~ /^application\/html.*/).nil? end |
#is_xml? ⇒ Boolean
Determines wether the reponse body is XML
Returns:
true if content type is appilcation/xml, false otherwise
39 40 41 |
# File 'lib/filestore/webdav/webdav.rb', line 39 def is_xml? not (@headers['Content-Type'] =~ /^application\/xml.*/).nil? end |