Class: ODDB::Business::Invoice::Item
- Inherits:
-
Object
- Object
- ODDB::Business::Invoice::Item
- Defined in:
- lib/oddb/business/invoice.rb
Instance Attribute Summary collapse
-
#expiry_time ⇒ Object
Returns the value of attribute expiry_time.
-
#price ⇒ Object
readonly
Returns the value of attribute price.
-
#quantity ⇒ Object
readonly
Returns the value of attribute quantity.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
-
#time ⇒ Object
readonly
Returns the value of attribute time.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#vat ⇒ Object
readonly
Returns the value of attribute vat.
Instance Method Summary collapse
- #expired? ⇒ Boolean
-
#initialize(type, text, quantity, unit, price) ⇒ Item
constructor
A new instance of Item.
- #total_brutto ⇒ Object
- #total_netto ⇒ Object
- #ydim_data ⇒ Object
Constructor Details
#initialize(type, text, quantity, unit, price) ⇒ Item
Returns a new instance of Item.
15 16 17 18 19 |
# File 'lib/oddb/business/invoice.rb', line 15 def initialize(type, text, quantity, unit, price) @type, @text, @quantity, @unit, @price \ = type, text, quantity.to_i, unit.to_s, price.to_f @time = Time.now end |
Instance Attribute Details
#expiry_time ⇒ Object
Returns the value of attribute expiry_time.
14 15 16 |
# File 'lib/oddb/business/invoice.rb', line 14 def expiry_time @expiry_time end |
#price ⇒ Object (readonly)
Returns the value of attribute price.
13 14 15 |
# File 'lib/oddb/business/invoice.rb', line 13 def price @price end |
#quantity ⇒ Object (readonly)
Returns the value of attribute quantity.
13 14 15 |
# File 'lib/oddb/business/invoice.rb', line 13 def quantity @quantity end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
13 14 15 |
# File 'lib/oddb/business/invoice.rb', line 13 def text @text end |
#time ⇒ Object (readonly)
Returns the value of attribute time.
13 14 15 |
# File 'lib/oddb/business/invoice.rb', line 13 def time @time end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
13 14 15 |
# File 'lib/oddb/business/invoice.rb', line 13 def type @type end |
#vat ⇒ Object (readonly)
Returns the value of attribute vat.
13 14 15 |
# File 'lib/oddb/business/invoice.rb', line 13 def vat @vat end |
Instance Method Details
#expired? ⇒ Boolean
20 21 22 |
# File 'lib/oddb/business/invoice.rb', line 20 def expired? @expiry_time && @expiry_time < Time.now end |
#total_brutto ⇒ Object
23 24 25 |
# File 'lib/oddb/business/invoice.rb', line 23 def total_brutto total_netto + vat end |
#total_netto ⇒ Object
26 27 28 |
# File 'lib/oddb/business/invoice.rb', line 26 def total_netto @price * @quantity end |
#ydim_data ⇒ Object
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/oddb/business/invoice.rb', line 32 def ydim_data { :expiry_time => @expiry_time, :price => @price, :quantity => @quantity, :text => @text, :time => @time, :unit => @unit, } end |