Class: Taxedo::Region
- Inherits:
-
Object
- Object
- Taxedo::Region
- Defined in:
- lib/taxedo/region.rb
Instance Method Summary collapse
- #calculate(amount, options = {}) ⇒ Object
-
#initialize(id) ⇒ Region
constructor
A new instance of Region.
Constructor Details
#initialize(id) ⇒ Region
Returns a new instance of Region.
4 5 6 7 |
# File 'lib/taxedo/region.rb', line 4 def initialize(id) @id = id @data = YAML.load_file(Taxedo.base_data_path + "regions.yml")['taxedo']['regions'][@id] end |
Instance Method Details
#calculate(amount, options = {}) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/taxedo/region.rb', line 9 def calculate(amount, ={}) = { :on => Time.now, :rule => 'standard' }.merge() receipt = Taxedo::Receipt.new(@id, amount) receipt.currency = @data['currency'] taxes([:rule], [:on]).each do |tax| receipt.add_tax tax[0], tax[1] end return receipt end |