Module: RussianPost::CountryFactory

Defined in:
lib/russianpost/country_factory.rb

Class Method Summary collapse

Class Method Details

.build(country_config, opts = {}) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/russianpost/country_factory.rb', line 6

def self.build(country_config, opts = {})
  country_list = opts[:country_list] || Iso3166Ru
  proxy        = country_list.find_by(iso: country_config[:id])
  
  RussianPost::Country.new(
    proxy.iso.to_i,
    proxy.alpha2,
    proxy.alpha3,
    proxy.name,
    proxy.english)
end