Class: Twinfield::Customer::RemittanceAdvice

Inherits:
Object
  • Object
show all
Defined in:
lib/twinfield/customer.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(sendtype: nil, sendmail: nil) ⇒ RemittanceAdvice

Returns a new instance of RemittanceAdvice.



40
41
42
43
# File 'lib/twinfield/customer.rb', line 40

def initialize(sendtype: nil, sendmail: nil)
  @sendtype = sendtype
  @sendmail = sendmail
end

Instance Attribute Details

#sendmailObject

Returns the value of attribute sendmail.



38
39
40
# File 'lib/twinfield/customer.rb', line 38

def sendmail
  @sendmail
end

#sendtypeObject

Returns the value of attribute sendtype.



38
39
40
# File 'lib/twinfield/customer.rb', line 38

def sendtype
  @sendtype
end

Class Method Details

.from_xml(nokogiri) ⇒ Object



59
60
61
62
63
64
# File 'lib/twinfield/customer.rb', line 59

def self.from_xml(nokogiri)
  obj = new
  obj.sendtype = nokogiri.css("sendtype").text
  obj.sendmail = nokogiri.css("sendmail").text
  obj
end

Instance Method Details

#to_hObject Also known as: to_hash



45
46
47
# File 'lib/twinfield/customer.rb', line 45

def to_h
  {sendtype: sendtype, sendmail: sendmail}
end

#to_xmlObject



50
51
52
53
54
55
56
57
# File 'lib/twinfield/customer.rb', line 50

def to_xml
  Nokogiri::XML::Builder.new do |xml|
    xml.remittanceadvice do
      xml.sendtype sendtype
      xml.sendmail sendmail
    end
  end.doc.root.to_xml
end