Class: Shushu::BillableUnit

Inherits:
Object
  • Object
show all
Defined in:
lib/models/billable_unit.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#fromObject

Returns the value of attribute from.



3
4
5
# File 'lib/models/billable_unit.rb', line 3

def from
  @from
end

#hidObject

Returns the value of attribute hid.



3
4
5
# File 'lib/models/billable_unit.rb', line 3

def hid
  @hid
end

#product_groupObject

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_nameObject

Returns the value of attribute product_name.



3
4
5
# File 'lib/models/billable_unit.rb', line 3

def product_name
  @product_name
end

#qtyObject

Returns the value of attribute qty.



3
4
5
# File 'lib/models/billable_unit.rb', line 3

def qty
  @qty
end

#rateObject

Returns the value of attribute rate.



3
4
5
# File 'lib/models/billable_unit.rb', line 3

def rate
  @rate
end

#rate_periodObject

Returns the value of attribute rate_period.



3
4
5
# File 'lib/models/billable_unit.rb', line 3

def rate_period
  @rate_period
end

#toObject

Returns the value of attribute to.



3
4
5
# File 'lib/models/billable_unit.rb', line 3

def to
  @to
end

Instance Method Details

#idObject



25
26
27
28
# File 'lib/models/billable_unit.rb', line 25

def id
  #TODO remove stub
  Time.now.to_i
end

#totalObject



30
31
32
# File 'lib/models/billable_unit.rb', line 30

def total
  @rate * @qty
end