Class: Bankjob::Payee
- Inherits:
-
Object
- Object
- Bankjob::Payee
- Defined in:
- lib/bankjob/payee.rb
Overview
A Payee object represents an entity in a in a bank Transaction that receives a payment.
A Scraper will create Payees while scraping web pages in an online banking site. In many cases Payees will not be distinguished in the online bank site in which case rules will have to be applied to separate the Payees
A Payee object knows how to write itself as a record in a CSV (Comma Separated Values) file using to_csv
or as an XML element in an OFX (Open Financial eXchange www.ofx.net) file using to_ofx
Instance Attribute Summary collapse
-
#address ⇒ Object
address of the payee Translates to OFX element ADDR1 – TODO Consider ADDR2,3.
-
#city ⇒ Object
city in which the payee is located Translates to OFX element CITY.
-
#country ⇒ Object
country in which the payee is located Translates to OFX element COUNTRY.
-
#name ⇒ Object
name of the payee Translates to OFX element NAME.
-
#phone ⇒ Object
phone number of the payee Translates to OFX element PHONE.
-
#postalcode ⇒ Object
post code or zip in which the payee is located Translates to OFX element POSTALCODE.
-
#state ⇒ Object
state in which the payee is located Translates to OFX element STATE.
Instance Method Summary collapse
-
#to_csv ⇒ Object
Generates a string representing this Payee as a single string for use in a comma separated values column.
-
#to_ofx ⇒ Object
Generates an XML string adhering to the OFX standard (see Open Financial Exchange www.ofx.net) representing a single Payee XML element.
-
#to_s ⇒ Object
Produces the Payee as a row of comma separated values (delegates to
to_csv
).
Instance Attribute Details
#address ⇒ Object
address of the payee Translates to OFX element ADDR1 – TODO Consider ADDR2,3
28 29 30 |
# File 'lib/bankjob/payee.rb', line 28 def address @address end |
#city ⇒ Object
city in which the payee is located Translates to OFX element CITY
32 33 34 |
# File 'lib/bankjob/payee.rb', line 32 def city @city end |
#country ⇒ Object
country in which the payee is located Translates to OFX element COUNTRY
44 45 46 |
# File 'lib/bankjob/payee.rb', line 44 def country @country end |
#name ⇒ Object
name of the payee Translates to OFX element NAME
23 24 25 |
# File 'lib/bankjob/payee.rb', line 23 def name @name end |
#phone ⇒ Object
phone number of the payee Translates to OFX element PHONE
48 49 50 |
# File 'lib/bankjob/payee.rb', line 48 def phone @phone end |
#postalcode ⇒ Object
post code or zip in which the payee is located Translates to OFX element POSTALCODE
40 41 42 |
# File 'lib/bankjob/payee.rb', line 40 def postalcode @postalcode end |
#state ⇒ Object
state in which the payee is located Translates to OFX element STATE
36 37 38 |
# File 'lib/bankjob/payee.rb', line 36 def state @state end |
Instance Method Details
#to_csv ⇒ Object
Generates a string representing this Payee as a single string for use in a comma separated values column
54 55 56 |
# File 'lib/bankjob/payee.rb', line 54 def to_csv name end |
#to_ofx ⇒ Object
Generates an XML string adhering to the OFX standard (see Open Financial Exchange www.ofx.net) representing a single Payee XML element.
The schema for the OFX produced is
<xsd:complexType name="Payee">
<xsd:annotation>
<xsd:documentation>
The OFX element "PAYEE" is of type "Payee"
</xsd:documentation>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="NAME" type="ofx:GenericNameType"/>
<xsd:sequence>
<xsd:element name="ADDR1" type="ofx:AddressType"/>
<xsd:sequence minOccurs="0">
<xsd:element name="ADDR2" type="ofx:AddressType"/>
<xsd:element name="ADDR3" type="ofx:AddressType" minOccurs="0"/>
</xsd:sequence>
</xsd:sequence>
<xsd:element name="CITY" type="ofx:AddressType"/>
<xsd:element name="STATE" type="ofx:StateType"/>
<xsd:element name="POSTALCODE" type="ofx:ZipType"/>
<xsd:element name="COUNTRY" type="ofx:CountryType" minOccurs="0"/>
<xsd:element name="PHONE" type="ofx:PhoneType"/>
</xsd:sequence>
</xsd:complexType>
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/bankjob/payee.rb', line 88 def to_ofx buf = "" # Set margin=6 to indent it nicely within the output from Transaction.to_ofx x = Builder::XmlMarkup.new(:target => buf, :indent => 2, :margin=>6) x.PAYEE { x.NAME name x.ADDR1 address x.CITY city x.STATE state x.POSTALCODE postalcode x.COUNTRY country unless country.nil? # minOccurs="0" in schema (above) x.PHONE phone } return buf end |
#to_s ⇒ Object
Produces the Payee as a row of comma separated values (delegates to to_csv
)
108 109 110 |
# File 'lib/bankjob/payee.rb', line 108 def to_s to_csv end |