Class: Inforouter::Responses::Document

Inherits:
Base
  • Object
show all
Defined in:
lib/inforouter/responses/document.rb

Overview

Response to an infoRouter Get Document API call.

See www.inforouter.com/web-services-80/default.aspx?op=GetDocument

Instance Attribute Summary

Attributes inherited from Base

#raw

Class Method Summary collapse

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) ⇒ Inforouter::Document

Parse an infoRouter response.

Parameters:

  • savon_response (Savon::Response)

    SOAP response.

Returns:



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/inforouter/responses/document.rb', line 17

def parse(savon_response)
  response = new(savon_response)
  document = response.match('get_document_response/get_document_result/response/document')
  Inforouter::Document.new(
    :document_id => document[:@document_id].to_i,
    :name => document[:@name].strip,
    :path => document[:@path].strip,
    :description => document[:@description].strip,
    :update_instructions => document[:@update_instructions].strip,
    :creation_date => parse_datetime(document[:@creation_date]),
    :modification_date => parse_datetime(document[:@modification_date]),
    :checkout_date => parse_datetime(document[:@checkout_date]),
    :checkout_by => document[:@checkout_by].strip,
    :checkout_by_user_name => document[:@checkout_by_user_name].strip,
    :size => document[:@size].to_i,
    :type => document[:@type].strip,
    :percent_complete => document[:@percent_complete].to_i,
    :importance => document[:@importance].strip,
    :retention_date => parse_datetime(document[:@retention_date]),
    :disposition_date => parse_datetime(document[:@disposition_date]),
    :expiration_date => parse_datetime(document[:@expiration_date]),
    :register_date => parse_datetime(document[:@register_date]),
    :registered_by => document[:@registered_by].strip,
    :doc_type_id => document[:@doc_type_id].to_i,
    :doc_type_name => document[:@doc_type_name].strip,
    :version_number => document[:@version_number].to_i,
  )
end