Class: WellsFargo::PaymentManager

Inherits:
Object
  • Object
show all
Defined in:
lib/wells_fargo/payment_manager.rb

Instance Method Summary collapse

Constructor Details

#initialize(business_name, options = {}) ⇒ PaymentManager

Returns a new instance of PaymentManager.



3
4
5
6
7
# File 'lib/wells_fargo/payment_manager.rb', line 3

def initialize(business_name, options = {})
  @elements = []
  @business_name = business_name
  @options = options
end

Instance Method Details

#fileObject



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/wells_fargo/payment_manager.rb', line 9

def file
  @xml = Builder::XmlMarkup.new(:indent => 2)
  attributes = {}
  attributes['CompanyID'] = @business_name
  attributes['xmlns:xsi'] = "http://www.w3.org/2001/XMLSchema-instance"
  attributes['PmtRecCount'] = @options[:pmg_rec_count] if @options[:pmg_rec_count]
  attributes['PmtRecTotal'] = @options[:pmg_rec_total] if @options[:pmg_rec_total]
  root = WellsFargo::Element::File.new(@xml, attributes)
  @xml.instruct!
  @xml.tag! root.element_name, root.attributes do
    yield root
  end
end

#to_xmlObject



23
24
25
# File 'lib/wells_fargo/payment_manager.rb', line 23

def to_xml
  @xml.target!
end