Class: Reji::Tax

Inherits:
Object
  • Object
show all
Defined in:
lib/reji/tax.rb

Instance Method Summary collapse

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

#amountObject

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

#currencyObject

Get the applied currency.



12
13
14
# File 'lib/reji/tax.rb', line 12

def currency
  @currency
end

#is_inclusiveObject

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_amountObject

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_rateObject

Stripe::TaxRate



32
33
34
# File 'lib/reji/tax.rb', line 32

def tax_rate
  @tax_rate
end