Class: Twinfield::Customer::Financials
- Inherits:
-
Object
- Object
- Twinfield::Customer::Financials
- Extended by:
- Helpers::Parsers
- Defined in:
- lib/twinfield/customer.rb
Instance Attribute Summary collapse
-
#accounttype ⇒ Object
Returns the value of attribute accounttype.
-
#childvalidations ⇒ Object
Returns the value of attribute childvalidations.
-
#collectionschema ⇒ Object
Returns the value of attribute collectionschema.
-
#collectmandate ⇒ Object
Returns the value of attribute collectmandate.
-
#duedays ⇒ Object
Returns the value of attribute duedays.
-
#ebilling ⇒ Object
Returns the value of attribute ebilling.
-
#ebillmail ⇒ Object
Returns the value of attribute ebillmail.
-
#level ⇒ Object
Returns the value of attribute level.
-
#matchtype ⇒ Object
Returns the value of attribute matchtype.
- #meansofpayment ⇒ Object
-
#payavailable ⇒ Object
Returns the value of attribute payavailable.
-
#paycode ⇒ Object
Returns the value of attribute paycode.
-
#performancetype ⇒ Object
Returns the value of attribute performancetype.
-
#relationsreference ⇒ Object
Returns the value of attribute relationsreference.
-
#subanalyse ⇒ Object
Returns the value of attribute subanalyse.
-
#substitutewith ⇒ Object
Returns the value of attribute substitutewith.
-
#substitutionlevel ⇒ Object
Returns the value of attribute substitutionlevel.
-
#vatcode ⇒ Object
Returns the value of attribute vatcode.
-
#vatobligatory ⇒ Object
Returns the value of attribute vatobligatory.
-
#vattype ⇒ Object
Returns the value of attribute vattype.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(matchtype: nil, accounttype: nil, subanalyse: nil, duedays: nil, level: nil, payavailable: nil, meansofpayment: nil, paycode: nil, ebilling: false, ebillmail: nil, substitutewith: nil, substitutionlevel: nil, relationsreference: nil, vattype: nil, vatcode: nil, vatobligatory: nil, performancetype: nil, collectmandate: nil, collectionschema: nil, childvalidations: nil) ⇒ Financials
constructor
A new instance of Financials.
- #to_h ⇒ Object (also: #to_hash)
- #to_xml ⇒ Object
Methods included from Helpers::Parsers
parse_date, parse_datetime, parse_float
Constructor Details
#initialize(matchtype: nil, accounttype: nil, subanalyse: nil, duedays: nil, level: nil, payavailable: nil, meansofpayment: nil, paycode: nil, ebilling: false, ebillmail: nil, substitutewith: nil, substitutionlevel: nil, relationsreference: nil, vattype: nil, vatcode: nil, vatobligatory: nil, performancetype: nil, collectmandate: nil, collectionschema: nil, childvalidations: nil) ⇒ Financials
Returns a new instance of Financials.
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 |
# File 'lib/twinfield/customer.rb', line 150 def initialize(matchtype: nil, accounttype: nil, subanalyse: nil, duedays: nil, level: nil, payavailable: nil, meansofpayment: nil, paycode: nil, ebilling: false, ebillmail: nil, substitutewith: nil, substitutionlevel: nil, relationsreference: nil, vattype: nil, vatcode: nil, vatobligatory: nil, performancetype: nil, collectmandate: nil, collectionschema: nil, childvalidations: nil) @matchtype = matchtype @accounttype = accounttype @subanalyse = subanalyse @duedays = duedays @level = level @payavailable = payavailable # Direct Debit / Automatische incasso @meansofpayment = meansofpayment @paycode = paycode @ebilling = ebilling @ebillmail = ebillmail @substitutewith = substitutewith @substitutionlevel = substitutionlevel @relationsreference = relationsreference # not in use @vattype = vattype # not in use @vatcode = vatcode @vatobligatory = vatobligatory @performancetype = performancetype @collectmandate = collectmandate.is_a?(Hash) ? Twinfield::Customer::CollectMandate.new(**collectmandate) : collectmandate @collectionschema = collectionschema @childvalidations = childvalidations end |
Instance Attribute Details
#accounttype ⇒ Object
Returns the value of attribute accounttype.
148 149 150 |
# File 'lib/twinfield/customer.rb', line 148 def accounttype @accounttype end |
#childvalidations ⇒ Object
Returns the value of attribute childvalidations.
148 149 150 |
# File 'lib/twinfield/customer.rb', line 148 def childvalidations @childvalidations end |
#collectionschema ⇒ Object
Returns the value of attribute collectionschema.
148 149 150 |
# File 'lib/twinfield/customer.rb', line 148 def collectionschema @collectionschema end |
#collectmandate ⇒ Object
Returns the value of attribute collectmandate.
148 149 150 |
# File 'lib/twinfield/customer.rb', line 148 def collectmandate @collectmandate end |
#duedays ⇒ Object
Returns the value of attribute duedays.
148 149 150 |
# File 'lib/twinfield/customer.rb', line 148 def duedays @duedays end |
#ebilling ⇒ Object
Returns the value of attribute ebilling.
148 149 150 |
# File 'lib/twinfield/customer.rb', line 148 def ebilling @ebilling end |
#ebillmail ⇒ Object
Returns the value of attribute ebillmail.
148 149 150 |
# File 'lib/twinfield/customer.rb', line 148 def ebillmail @ebillmail end |
#level ⇒ Object
Returns the value of attribute level.
148 149 150 |
# File 'lib/twinfield/customer.rb', line 148 def level @level end |
#matchtype ⇒ Object
Returns the value of attribute matchtype.
148 149 150 |
# File 'lib/twinfield/customer.rb', line 148 def matchtype @matchtype end |
#meansofpayment ⇒ Object
173 174 175 |
# File 'lib/twinfield/customer.rb', line 173 def meansofpayment @meansofpayment || (payavailable ? "paymentfile" : "none") end |
#payavailable ⇒ Object
Returns the value of attribute payavailable.
147 148 149 |
# File 'lib/twinfield/customer.rb', line 147 def payavailable @payavailable end |
#paycode ⇒ Object
Returns the value of attribute paycode.
148 149 150 |
# File 'lib/twinfield/customer.rb', line 148 def paycode @paycode end |
#performancetype ⇒ Object
Returns the value of attribute performancetype.
148 149 150 |
# File 'lib/twinfield/customer.rb', line 148 def performancetype @performancetype end |
#relationsreference ⇒ Object
Returns the value of attribute relationsreference.
148 149 150 |
# File 'lib/twinfield/customer.rb', line 148 def relationsreference @relationsreference end |
#subanalyse ⇒ Object
Returns the value of attribute subanalyse.
148 149 150 |
# File 'lib/twinfield/customer.rb', line 148 def subanalyse @subanalyse end |
#substitutewith ⇒ Object
Returns the value of attribute substitutewith.
148 149 150 |
# File 'lib/twinfield/customer.rb', line 148 def substitutewith @substitutewith end |
#substitutionlevel ⇒ Object
Returns the value of attribute substitutionlevel.
148 149 150 |
# File 'lib/twinfield/customer.rb', line 148 def substitutionlevel @substitutionlevel end |
#vatcode ⇒ Object
Returns the value of attribute vatcode.
148 149 150 |
# File 'lib/twinfield/customer.rb', line 148 def vatcode @vatcode end |
#vatobligatory ⇒ Object
Returns the value of attribute vatobligatory.
148 149 150 |
# File 'lib/twinfield/customer.rb', line 148 def vatobligatory @vatobligatory end |
#vattype ⇒ Object
Returns the value of attribute vattype.
148 149 150 |
# File 'lib/twinfield/customer.rb', line 148 def vattype @vattype end |
Class Method Details
.from_xml(nokogiri) ⇒ Object
236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 |
# File 'lib/twinfield/customer.rb', line 236 def self.from_xml(nokogiri) obj = new obj.matchtype = nokogiri.css("matchtype").text obj.accounttype = nokogiri.css("accounttype").text obj.subanalyse = nokogiri.css("subanalyse").text obj.duedays = nokogiri.css("duedays").text obj.level = nokogiri.css("level").text obj.payavailable = nokogiri.css("payavailable").text obj.meansofpayment = nokogiri.css("meansofpayment").text obj.paycode = nokogiri.css("paycode").text obj.ebilling = nokogiri.css("ebilling").text == "true" obj.ebillmail = nokogiri.css("ebillmail").text obj.substitutewith = nokogiri.css("substitutewith").text obj.substitutionlevel = nokogiri.css("substitutionlevel").text obj.relationsreference = nokogiri.css("relationsreference").text obj.vattype = nokogiri.css("vattype").text obj.vatcode = nokogiri.css("vatcode").text obj.vatobligatory = nokogiri.css("vatobligatory").text obj.performancetype = nokogiri.css("performancetype").text obj.collectmandate = CollectMandate.from_xml(nokogiri.css("collectmandate")) obj.collectionschema = nokogiri.css("collectionschema").text obj.childvalidations = nokogiri.css("childvalidations").text&.strip obj end |
Instance Method Details
#to_h ⇒ Object Also known as: to_hash
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 |
# File 'lib/twinfield/customer.rb', line 184 def to_h { matchtype: matchtype, accounttype: accounttype, subanalyse: subanalyse, duedays: duedays, level: level, payavailable: payavailable, meansofpayment: meansofpayment, paycode: paycode, ebilling: ebilling, ebillmail: ebillmail, substitutewith: substitutewith, substitutionlevel: substitutionlevel, relationsreference: relationsreference, vattype: vattype, vatcode: vatcode, vatobligatory: vatobligatory, performancetype: performancetype, collectmandate: collectmandate&.to_h, collectionschema: collectionschema, childvalidations: childvalidations } end |
#to_xml ⇒ Object
210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 |
# File 'lib/twinfield/customer.rb', line 210 def to_xml Nokogiri::XML::Builder.new do |xml| xml.financials do xml.matchtype matchtype if matchtype xml.accounttype accounttype if accounttype xml.subanalyse subanalyse if subanalyse xml.duedays duedays if duedays xml.level level if level xml.payavailable payavailable if payavailable xml.meansofpayment meansofpayment if meansofpayment xml.paycode paycode if paycode xml.ebilling ebilling if ebilling xml.ebillmail ebillmail if ebillmail xml.substitutewith substitutewith if substitutewith xml.substitutionlevel substitutionlevel if substitutionlevel xml.relationsreference relationsreference if relationsreference xml.vattype vattype if vattype xml.vatcode vatcode if vatcode xml.vatobligatory vatobligatory if vatobligatory xml.performancetype performancetype if performancetype xml << collectmandate.to_xml if collectmandate xml.collectionschema collectionschema if collectionschema end end.doc.root.to_xml end |