Class: Reji::Tax
- Inherits:
-
Object
- Object
- Reji::Tax
- Defined in:
- lib/reji/tax.rb
Instance Attribute Summary collapse
-
#currency ⇒ Object
readonly
Get the applied currency.
-
#tax_rate ⇒ Object
readonly
Stripe::TaxRate.
Instance Method Summary collapse
-
#amount ⇒ Object
Get the total tax that was paid (or will be paid).
-
#inclusive? ⇒ Boolean
Determine if the tax is inclusive or not.
-
#initialize(amount, currency, tax_rate) ⇒ Tax
constructor
A new instance of Tax.
-
#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).
- #respond_to_missing?(method_name, include_private = false) ⇒ Boolean
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.
33 34 35 |
# File 'lib/reji/tax.rb', line 33 def method_missing(key) @tax_rate[key] end |
Instance Attribute Details
#currency ⇒ Object (readonly)
Get the applied currency.
12 13 14 |
# File 'lib/reji/tax.rb', line 12 def currency @currency end |
#tax_rate ⇒ Object (readonly)
Stripe::TaxRate
30 31 32 |
# File 'lib/reji/tax.rb', line 30 def tax_rate @tax_rate end |
Instance Method Details
#amount ⇒ Object
Get the total tax that was paid (or will be paid).
15 16 17 |
# File 'lib/reji/tax.rb', line 15 def amount format_amount(@amount) end |
#inclusive? ⇒ Boolean
Determine if the tax is inclusive or not.
25 26 27 |
# File 'lib/reji/tax.rb', line 25 def inclusive? @tax_rate.inclusive end |
#raw_amount ⇒ Object
Get the raw total tax that was paid (or will be paid).
20 21 22 |
# File 'lib/reji/tax.rb', line 20 def raw_amount @amount end |
#respond_to_missing?(method_name, include_private = false) ⇒ Boolean
37 38 39 |
# File 'lib/reji/tax.rb', line 37 def respond_to_missing?(method_name, include_private = false) super end |