Class: Reji::Tax
- Inherits:
-
Object
- Object
- Reji::Tax
- Defined in:
- lib/reji/tax.rb
Instance Method Summary collapse
-
#amount ⇒ Object
Get the total tax that was paid (or will be paid).
-
#currency ⇒ Object
Get the applied currency.
-
#initialize(amount, currency, tax_rate) ⇒ Tax
constructor
A new instance of Tax.
-
#is_inclusive ⇒ Object
Determine if the tax is inclusive or not.
-
#method_missing(key) ⇒ Object
Dynamically get values from the Stripe TaxRate.
-
#raw_amount ⇒ Object
Get the raw total tax that was paid (or will be paid).
-
#tax_rate ⇒ Object
Stripe::TaxRate.
Constructor Details
#initialize(amount, currency, tax_rate) ⇒ Tax
Returns a new instance of Tax.
5 6 7 8 9 |
# File 'lib/reji/tax.rb', line 5 def initialize(amount, currency, tax_rate) @amount = amount @currency = currency @tax_rate = tax_rate end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(key) ⇒ Object
Dynamically get values from the Stripe TaxRate.
37 38 39 |
# File 'lib/reji/tax.rb', line 37 def method_missing(key) @tax_rate[key] end |
Instance Method Details
#amount ⇒ Object
Get the total tax that was paid (or will be paid).
17 18 19 |
# File 'lib/reji/tax.rb', line 17 def amount self.format_amount(@amount) end |
#currency ⇒ Object
Get the applied currency.
12 13 14 |
# File 'lib/reji/tax.rb', line 12 def currency @currency end |
#is_inclusive ⇒ Object
Determine if the tax is inclusive or not.
27 28 29 |
# File 'lib/reji/tax.rb', line 27 def is_inclusive @tax_rate.inclusive end |
#raw_amount ⇒ Object
Get the raw total tax that was paid (or will be paid).
22 23 24 |
# File 'lib/reji/tax.rb', line 22 def raw_amount @amount end |
#tax_rate ⇒ Object
Stripe::TaxRate
32 33 34 |
# File 'lib/reji/tax.rb', line 32 def tax_rate @tax_rate end |