Class: OnlyofficeDocumentserverConversionHelper::XmlResponceParser
- Inherits:
-
Object
- Object
- OnlyofficeDocumentserverConversionHelper::XmlResponceParser
- Defined in:
- lib/onlyoffice_documentserver_conversion_helper/xml_responce_parser.rb
Overview
Class for parse Xml responce
Instance Method Summary collapse
-
#file_format ⇒ String
Output file format.
-
#initialize(string_with_xml, file_format, result_in_zip: false) ⇒ XmlResponceParser
constructor
A new instance of XmlResponceParser.
-
#result_url ⇒ String
Method parses server response returning url with unescape HTML.
Constructor Details
#initialize(string_with_xml, file_format, result_in_zip: false) ⇒ XmlResponceParser
Returns a new instance of XmlResponceParser.
6 7 8 9 10 |
# File 'lib/onlyoffice_documentserver_conversion_helper/xml_responce_parser.rb', line 6 def initialize(string_with_xml, file_format, result_in_zip: false) @string_with_xml = string_with_xml @file_format = file_format @result_in_zip = result_in_zip end |
Instance Method Details
#file_format ⇒ String
Returns output file format.
13 14 15 16 17 |
# File 'lib/onlyoffice_documentserver_conversion_helper/xml_responce_parser.rb', line 13 def file_format return 'zip' if @result_in_zip @file_format end |
#result_url ⇒ String
Method parses server response returning url with unescape HTML
22 23 24 25 |
# File 'lib/onlyoffice_documentserver_conversion_helper/xml_responce_parser.rb', line 22 def result_url res_result = /(http|https).*\.(#{file_format})/.match(@string_with_xml) CGI.unescapeHTML(res_result.to_s) end |