Class: Biller
- Inherits:
-
Object
- Object
- Biller
- Defined in:
- lib/invoices/models/biller.rb
Instance Attribute Summary collapse
-
#city ⇒ Object
Returns the value of attribute city.
-
#email ⇒ Object
Returns the value of attribute email.
-
#name ⇒ Object
Returns the value of attribute name.
-
#phone ⇒ Object
Returns the value of attribute phone.
-
#state ⇒ Object
Returns the value of attribute state.
-
#street1 ⇒ Object
Returns the value of attribute street1.
-
#street2 ⇒ Object
Returns the value of attribute street2.
-
#zip ⇒ Object
Returns the value of attribute zip.
Instance Method Summary collapse
Instance Attribute Details
#city ⇒ Object
Returns the value of attribute city.
2 3 4 |
# File 'lib/invoices/models/biller.rb', line 2 def city @city end |
#email ⇒ Object
Returns the value of attribute email.
2 3 4 |
# File 'lib/invoices/models/biller.rb', line 2 def email @email end |
#name ⇒ Object
Returns the value of attribute name.
2 3 4 |
# File 'lib/invoices/models/biller.rb', line 2 def name @name end |
#phone ⇒ Object
Returns the value of attribute phone.
2 3 4 |
# File 'lib/invoices/models/biller.rb', line 2 def phone @phone end |
#state ⇒ Object
Returns the value of attribute state.
2 3 4 |
# File 'lib/invoices/models/biller.rb', line 2 def state @state end |
#street1 ⇒ Object
Returns the value of attribute street1.
2 3 4 |
# File 'lib/invoices/models/biller.rb', line 2 def street1 @street1 end |
#street2 ⇒ Object
Returns the value of attribute street2.
2 3 4 |
# File 'lib/invoices/models/biller.rb', line 2 def street2 @street2 end |
#zip ⇒ Object
Returns the value of attribute zip.
2 3 4 |
# File 'lib/invoices/models/biller.rb', line 2 def zip @zip end |
Instance Method Details
#default(*boolean) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/invoices/models/biller.rb', line 4 def default(*boolean) biller = choose_db(*boolean).execute("select * from billers").first @name = biller[0].to_s @street1 = biller[1].to_s @street2 = biller[2].to_s @city = biller[3].to_s @state = biller[4].to_s @zip = biller[5].to_s @phone = biller[6].to_s @email = biller[7].to_s return self end |
#save(*boolean) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/invoices/models/biller.rb', line 16 def save(*boolean) # Should raise error unless all fields except for street2 are filled choose_db(*boolean).execute("INSERT INTO billers (name, street1, street2, city, state, zip, phone, email) VALUES (?, ?, ?, ?, ?, ?, ?, ?)", [@name, @street1, @street2, @city, @state, @zip, @phone, @email]) end |