Class: FreeAgent::Invoice
- Defined in:
- lib/free_agent/objects/invoice.rb
Instance Method Summary collapse
-
#initialize(attributes) ⇒ Invoice
constructor
A new instance of Invoice.
Methods inherited from Object
Constructor Details
#initialize(attributes) ⇒ Invoice
Returns a new instance of Invoice.
3 4 5 6 7 8 9 10 11 |
# File 'lib/free_agent/objects/invoice.rb', line 3 def initialize(attributes) super to_ostruct(attributes) # Convert amounts to BigDecimal self.net_value = BigDecimal(self.net_value.to_s).to_f if self.net_value self.total_value = BigDecimal(self.total_value.to_s).to_f if self.total_value self.paid_value = BigDecimal(self.paid_value.to_s).to_f if self.paid_value self.due_value = BigDecimal(self.due_value.to_s).to_f if self.due_value end |