Class: Zebra::Epl::CountryCode

Inherits:
Object
  • Object
show all
Defined in:
lib/zebra/epl/country_code.rb

Defined Under Namespace

Classes: InvalidCountryCodeError

Constant Summary collapse

BELGIUM =
"032"
CANADA =
"002"
DENMARK =
"045"
FINLAND =
"358"
FRANCE =
"033"
GERMANY =
"049"
NETHERLANDS =
"031"
ITALY =
"039"
LATIN_AMERICA =
"003"
NORWAY =
"047"
PORTUGAL =
"351"
SOUTH_AFRICA =
"027"
SPAIN =
"034"
SWEDEN =
"046"
SWITZERLAND =
"041"
UK =
"044"
USA =
"001"

Class Method Summary collapse

Class Method Details

.valid_country_code?(code) ⇒ Boolean

Returns:

  • (Boolean)


25
26
27
28
29
# File 'lib/zebra/epl/country_code.rb', line 25

def self.valid_country_code?(code)
  [BELGIUM, CANADA, DENMARK, FINLAND, FRANCE, GERMANY, NETHERLANDS,
   ITALY, LATIN_AMERICA, NORWAY, PORTUGAL, SOUTH_AFRICA, SPAIN, SWEDEN, SWITZERLAND,
   UK, USA].include?(code)
end

.validate_country_code(code) ⇒ Object



31
32
33
# File 'lib/zebra/epl/country_code.rb', line 31

def self.validate_country_code(code)
  raise InvalidCountryCodeError unless valid_country_code?(code)
end