Class: Shushu::BillableUnit
- Inherits:
-
Object
- Object
- Shushu::BillableUnit
- Defined in:
- lib/models/billable_unit.rb
Instance Attribute Summary collapse
-
#from ⇒ Object
Returns the value of attribute from.
-
#hid ⇒ Object
Returns the value of attribute hid.
-
#product_group ⇒ Object
Returns the value of attribute product_group.
-
#product_name ⇒ Object
Returns the value of attribute product_name.
-
#qty ⇒ Object
Returns the value of attribute qty.
-
#rate ⇒ Object
Returns the value of attribute rate.
-
#rate_period ⇒ Object
Returns the value of attribute rate_period.
-
#to ⇒ Object
Returns the value of attribute to.
Instance Method Summary collapse
- #id ⇒ Object
-
#initialize(args_hash) ⇒ BillableUnit
constructor
A new instance of BillableUnit.
- #total ⇒ Object
Constructor Details
#initialize(args_hash) ⇒ BillableUnit
Returns a new instance of BillableUnit.
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/models/billable_unit.rb', line 14 def initialize(args_hash) @hid = args_hash["hid"] @from = args_hash["from"] @to = args_hash["to"] @qty = args_hash["qty"].to_f @rate = args_hash["rate"].to_i @rate_period = args_hash["rate_period"] @product_name = args_hash["product_name"] @product_group = args_hash["product_group"] end |
Instance Attribute Details
#from ⇒ Object
Returns the value of attribute from.
3 4 5 |
# File 'lib/models/billable_unit.rb', line 3 def from @from end |
#hid ⇒ Object
Returns the value of attribute hid.
3 4 5 |
# File 'lib/models/billable_unit.rb', line 3 def hid @hid end |
#product_group ⇒ Object
Returns the value of attribute product_group.
3 4 5 |
# File 'lib/models/billable_unit.rb', line 3 def product_group @product_group end |
#product_name ⇒ Object
Returns the value of attribute product_name.
3 4 5 |
# File 'lib/models/billable_unit.rb', line 3 def product_name @product_name end |
#qty ⇒ Object
Returns the value of attribute qty.
3 4 5 |
# File 'lib/models/billable_unit.rb', line 3 def qty @qty end |
#rate ⇒ Object
Returns the value of attribute rate.
3 4 5 |
# File 'lib/models/billable_unit.rb', line 3 def rate @rate end |
#rate_period ⇒ Object
Returns the value of attribute rate_period.
3 4 5 |
# File 'lib/models/billable_unit.rb', line 3 def rate_period @rate_period end |
#to ⇒ Object
Returns the value of attribute to.
3 4 5 |
# File 'lib/models/billable_unit.rb', line 3 def to @to end |
Instance Method Details
#id ⇒ Object
25 26 27 28 |
# File 'lib/models/billable_unit.rb', line 25 def id #TODO remove stub Time.now.to_i end |
#total ⇒ Object
30 31 32 |
# File 'lib/models/billable_unit.rb', line 30 def total @rate * @qty end |