Class: Inforouter::Responses::Documents
- Defined in:
- lib/inforouter/responses/documents.rb
Overview
Returns the list of documents in the specified path in short form.
www.inforouter.com/web-services-80/default.aspx?op=GetDocuments1
Instance Attribute Summary
Attributes inherited from Base
Class Method Summary collapse
-
.parse(savon_response) ⇒ Array<Inforouter::Document>
Parse an infoRouter response.
Methods inherited from Base
error_message, #initialize, #match, parse_datetime, response_success, set_dsl
Constructor Details
This class inherits a constructor from Inforouter::Responses::Base
Class Method Details
.parse(savon_response) ⇒ Array<Inforouter::Document>
Parse an infoRouter response.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/inforouter/responses/documents.rb', line 16 def parse(savon_response) response = new(savon_response) data = response.match('get_documents1_response/get_documents1_result/response') return [] if data[:@itemcount].to_i == 0 data[:d] = [data[:d]] if data[:d].is_a?(Hash) data[:d].map do |document| Inforouter::Document.new( id: document[:@id].to_i, name: document[:@n].strip, modification_date: parse_datetime(document[:@mdate]), creation_date: parse_datetime(document[:@cdate]), size: document[:@size].to_i, description: document[:@dformat].strip, checkout_by_username: document[:@chkoutbyusername].strip, checkout_by_full_name: document[:@chkoutbyfullname].strip, version: document[:@version].to_i, register_date: parse_datetime(document[:@regdate]), published_version: document[:@publishedversion].to_i, type: document[:@dtype].to_i ) end end |