Class: Prestashop::Mapper::Tax

Inherits:
Model
  • Object
show all
Defined in:
lib/prestashop/mapper/models/tax.rb

Class Method Summary collapse

Methods inherited from Model

#hash_lang, #meta_description, #meta_keywords, #meta_title, model, resource

Methods included from Extension

included

Class Method Details

.get_by_country(iso_code) ⇒ Object


17
18
19
20
# File 'lib/prestashop/mapper/models/tax.rb', line 17

def get_by_country iso_code
  id_country = Country.find_by iso_code: iso_code
  get_by_id_country id_country
end

.get_by_id_country(id) ⇒ Object


9
10
11
12
13
14
15
# File 'lib/prestashop/mapper/models/tax.rb', line 9

def get_by_id_country id 
  taxes = {}
  TaxRule.get_by_id_country(id).each do |value|
    taxes[find(value[:id_tax])[:rate].to_i.to_s] = value[:id_tax_rules_group]
  end
  taxes
end