lib/inforouter/responses/documents.rb in inforouter-0.2.6 vs lib/inforouter/responses/documents.rb in inforouter-0.2.7
- old
+ new
@@ -13,11 +13,12 @@
# @param savon_response [Savon::Response] SOAP response.
#
# @return [Array<Inforouter::Document>]
def parse(savon_response)
response = new(savon_response)
- documents = response.match('get_documents1_response/get_documents1_result/response/d')
- documents.map do |document|
+ data = response.match('get_documents1_response/get_documents1_result/response')
+ return [] if data[:@itemcount].to_i == 0
+ 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]),