class Reji::Tax

Attributes

currency[R]

Get the applied currency.

tax_rate[R]

Stripe::TaxRate

Public Class Methods

new(amount, currency, tax_rate) click to toggle source
# File lib/reji/tax.rb, line 5
def initialize(amount, currency, tax_rate)
  @amount = amount
  @currency = currency
  @tax_rate = tax_rate
end

Public Instance Methods

amount() click to toggle source

Get the total tax that was paid (or will be paid).

# File lib/reji/tax.rb, line 15
def amount
  format_amount(@amount)
end
inclusive?() click to toggle source

Determine if the tax is inclusive or not.

# File lib/reji/tax.rb, line 25
def inclusive?
  @tax_rate.inclusive
end
method_missing(key) click to toggle source

Dynamically get values from the Stripe TaxRate.

# File lib/reji/tax.rb, line 33
def method_missing(key)
  @tax_rate[key]
end
raw_amount() click to toggle source

Get the raw total tax that was paid (or will be paid).

# File lib/reji/tax.rb, line 20
def raw_amount
  @amount
end
respond_to_missing?(method_name, include_private = false) click to toggle source
Calls superclass method
# File lib/reji/tax.rb, line 37
def respond_to_missing?(method_name, include_private = false)
  super
end

Protected Instance Methods

format_amount(amount) click to toggle source

Format the given amount into a displayable currency.

# File lib/reji/tax.rb, line 42
          def format_amount(amount)
  Reji.format_amount(amount, @currency)
end