Sha256: 3478f75bfb0979085d397e92c3df089b34be2c7f6a68314c01749f1ff2a7abc7

Contents?: true

Size: 993 Bytes

Versions: 4

Compression:

Stored size: 993 Bytes

Contents

# encoding: utf-8
module Zebra
  module Epl
    class CountryCode
      class InvalidCountryCodeError < StandardError; end

      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"

      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

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
zebra-epl-0.0.8 lib/zebra/epl/country_code.rb
zebra-epl-0.0.7 lib/zebra/epl/country_code.rb
zebra-epl-0.0.6 lib/zebra/epl/country_code.rb
zebra-epl-0.0.5 lib/zebra/epl/country_code.rb