Class: Ufebs::Documents::Package

Inherits:
Object
  • Object
show all
Includes:
HappyMapper
Defined in:
lib/ufebs/documents/package.rb

Constant Summary collapse

SYSTEM_CODE =
'02'

Instance Method Summary collapse

Constructor Details

#initialize(payment_orders = [], params = {}) ⇒ Package

Returns a new instance of Package.



31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/ufebs/documents/package.rb', line 31

def initialize(payment_orders = [], params = {})
  @payment_orders = payment_orders

  @ed_date   = Date.parse(params.fetch(:ed_date){Time.now}.to_s).strftime('%Y-%m-%d')
  @ed_author = params[:ed_author]
  @ed_receiver = params[:ed_receiver]
  @number    = params[:number]
  @quantity  = params[:quantity] || payment_orders.size
  @sum       = params[:sum]
  @system_code   = params.fetch(:system_code) { SYSTEM_CODE }

  super()
end

Instance Method Details

#to_xml(encoding: 'UTF-8') ⇒ Object



45
46
47
# File 'lib/ufebs/documents/package.rb', line 45

def to_xml(encoding: 'UTF-8')
  super(Nokogiri::XML::Builder.new(:encoding => encoding)).to_xml
end