Class: Interfactura::Ruby::Invoice
- Inherits:
-
Object
- Object
- Interfactura::Ruby::Invoice
- Defined in:
- lib/interfactura/ruby/invoice.rb
Constant Summary collapse
- IVA =
0.16
Instance Attribute Summary collapse
-
#city ⇒ Object
Returns the value of attribute city.
-
#colony ⇒ Object
Returns the value of attribute colony.
-
#email ⇒ Object
Returns the value of attribute email.
-
#id ⇒ Object
Returns the value of attribute id.
-
#municipality ⇒ Object
Returns the value of attribute municipality.
-
#name ⇒ Object
Returns the value of attribute name.
-
#number ⇒ Object
Returns the value of attribute number.
-
#phone ⇒ Object
Returns the value of attribute phone.
-
#rfc ⇒ Object
Returns the value of attribute rfc.
-
#state ⇒ Object
Returns the value of attribute state.
-
#street ⇒ Object
Returns the value of attribute street.
-
#total ⇒ Object
Returns the value of attribute total.
-
#zipcode ⇒ Object
Returns the value of attribute zipcode.
Instance Method Summary collapse
- #get_binding ⇒ Object
-
#initialize(attributes = {}) ⇒ Invoice
constructor
A new instance of Invoice.
- #iva ⇒ Object
- #subtotal ⇒ Object
- #to_xml ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ Invoice
Returns a new instance of Invoice.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/interfactura/ruby/invoice.rb', line 10 def initialize(attributes = {}) @id = attributes[:id] @total = attributes[:total] @zipcode = attributes[:zipcode] @state = attributes[:state] @colony = attributes[:colony] @rfc = attributes[:rfc] @name = attributes[:name] @phone = attributes[:phone] @email = attributes[:email] @city = attributes[:city] @municipality = attributes[:municipality] @street = attributes[:street] @number = attributes[:number] end |
Instance Attribute Details
#city ⇒ Object
Returns the value of attribute city.
4 5 6 |
# File 'lib/interfactura/ruby/invoice.rb', line 4 def city @city end |
#colony ⇒ Object
Returns the value of attribute colony.
4 5 6 |
# File 'lib/interfactura/ruby/invoice.rb', line 4 def colony @colony end |
#email ⇒ Object
Returns the value of attribute email.
4 5 6 |
# File 'lib/interfactura/ruby/invoice.rb', line 4 def email @email end |
#id ⇒ Object
Returns the value of attribute id.
4 5 6 |
# File 'lib/interfactura/ruby/invoice.rb', line 4 def id @id end |
#municipality ⇒ Object
Returns the value of attribute municipality.
4 5 6 |
# File 'lib/interfactura/ruby/invoice.rb', line 4 def municipality @municipality end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/interfactura/ruby/invoice.rb', line 4 def name @name end |
#number ⇒ Object
Returns the value of attribute number.
4 5 6 |
# File 'lib/interfactura/ruby/invoice.rb', line 4 def number @number end |
#phone ⇒ Object
Returns the value of attribute phone.
4 5 6 |
# File 'lib/interfactura/ruby/invoice.rb', line 4 def phone @phone end |
#rfc ⇒ Object
Returns the value of attribute rfc.
4 5 6 |
# File 'lib/interfactura/ruby/invoice.rb', line 4 def rfc @rfc end |
#state ⇒ Object
Returns the value of attribute state.
4 5 6 |
# File 'lib/interfactura/ruby/invoice.rb', line 4 def state @state end |
#street ⇒ Object
Returns the value of attribute street.
4 5 6 |
# File 'lib/interfactura/ruby/invoice.rb', line 4 def street @street end |
#total ⇒ Object
Returns the value of attribute total.
4 5 6 |
# File 'lib/interfactura/ruby/invoice.rb', line 4 def total @total end |
#zipcode ⇒ Object
Returns the value of attribute zipcode.
4 5 6 |
# File 'lib/interfactura/ruby/invoice.rb', line 4 def zipcode @zipcode end |
Instance Method Details
#get_binding ⇒ Object
39 40 41 |
# File 'lib/interfactura/ruby/invoice.rb', line 39 def get_binding binding() end |
#iva ⇒ Object
30 31 32 |
# File 'lib/interfactura/ruby/invoice.rb', line 30 def iva (total - subtotal).round(2) end |
#subtotal ⇒ Object
26 27 28 |
# File 'lib/interfactura/ruby/invoice.rb', line 26 def subtotal (total / 1.16).round(2) end |
#to_xml ⇒ Object
34 35 36 37 |
# File 'lib/interfactura/ruby/invoice.rb', line 34 def to_xml path = "#{File.dirname(__FILE__)}/templates/message_template.xml.erb" ERB.new(File.read(path), nil, '-').result(self.get_binding) end |