Class: Driver::Base::Fiscal::SaleItem
- Inherits:
-
Object
- Object
- Driver::Base::Fiscal::SaleItem
- Includes:
- ActiveModel::Validations
- Defined in:
- app/models/extface/driver/base/fiscal.rb
Instance Attribute Summary collapse
-
#neto ⇒ Object
readonly
Float.
-
#number ⇒ Object
readonly
Float.
-
#percent ⇒ Object
readonly
Float.
-
#price ⇒ Object
readonly
Float.
-
#qty ⇒ Object
readonly
Float.
-
#tax_group ⇒ Object
readonly
Float.
-
#text1 ⇒ Object
readonly
Float.
-
#text2 ⇒ Object
readonly
Float.
Instance Method Summary collapse
-
#initialize(attributes) ⇒ SaleItem
constructor
A new instance of SaleItem.
Constructor Details
#initialize(attributes) ⇒ SaleItem
Returns a new instance of SaleItem.
69 70 71 72 73 74 |
# File 'app/models/extface/driver/base/fiscal.rb', line 69 def initialize(attributes) @price, @text1, @text2, @tax_group, @qty, @percent, @neto, @number = attributes[:price], attributes[:text1].to_s, attributes[:text2].to_s, attributes[:tax_group], attributes[:qty], attributes[:percent], attributes[:neto], attributes[:number] raise "invalid price" unless price.kind_of?(Float) raise "invalid tax group" if tax_group.present? && !tax_group.kind_of?(Fixnum) raise "invalid qty" if qty.present? && !qty.kind_of?(Float) end |
Instance Attribute Details
#neto ⇒ Object (readonly)
Float
62 63 64 |
# File 'app/models/extface/driver/base/fiscal.rb', line 62 def neto @neto end |
#number ⇒ Object (readonly)
Float
62 63 64 |
# File 'app/models/extface/driver/base/fiscal.rb', line 62 def number @number end |
#percent ⇒ Object (readonly)
Float
62 63 64 |
# File 'app/models/extface/driver/base/fiscal.rb', line 62 def percent @percent end |
#price ⇒ Object (readonly)
Float
62 63 64 |
# File 'app/models/extface/driver/base/fiscal.rb', line 62 def price @price end |
#qty ⇒ Object (readonly)
Float
62 63 64 |
# File 'app/models/extface/driver/base/fiscal.rb', line 62 def qty @qty end |
#tax_group ⇒ Object (readonly)
Float
62 63 64 |
# File 'app/models/extface/driver/base/fiscal.rb', line 62 def tax_group @tax_group end |
#text1 ⇒ Object (readonly)
Float
62 63 64 |
# File 'app/models/extface/driver/base/fiscal.rb', line 62 def text1 @text1 end |
#text2 ⇒ Object (readonly)
Float
62 63 64 |
# File 'app/models/extface/driver/base/fiscal.rb', line 62 def text2 @text2 end |