6a873e0f
chadzink
Implement PorTii ...
|
1
2
3
4
5
6
7
8
9
10
11
12
13
|
# frozen_string_literal: true
require 'syspro/business_objects/parsers/portii_parser'
require 'erb'
module Syspro
module BusinessObjects
class PorTii < ApiResource
include Syspro::ApiOperations::Transaction
include Syspro::BusinessObjects::Parsers
# input params
attr_accessor :transaction_date,
|
6a873e0f
chadzink
Implement PorTii ...
|
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
45
|
def call(user_id)
xml_parameters = params_template.result(binding)
xml_in = template.result(binding)
business_object = 'PORTII'
params = { 'UserId' => user_id,
'BusinessObject' => business_object,
'XmlParameters' => xml_parameters,
'XmlIn' => xml_in }
resp = PorTii.post(params)
parse_response(resp)
end
def template
ERB.new File.read(File.expand_path('schemas/portii_doc.xml.erb', File.dirname(__FILE__))), nil, '%'
end
def params_template
ERB.new File.read(File.expand_path('schemas/portii.xml.erb', File.dirname(__FILE__))), nil, '%'
end
def parse_response(resp)
handle_errors(resp)
parser = PorTiiParser.new(resp[0].data)
parser.parse
end
|