Sha256: e04826173435ab8480800340a70d878b640b8565174cfab389fa0822f12ac2f2

Contents?: true

Size: 879 Bytes

Versions: 25

Compression:

Stored size: 879 Bytes

Contents

module Shoppe
  module CountryImporter
    def self.import
      
      eu_members = ['Austria', 'Belgium', 'Bulgaria', 'Croatia','Cyprus','Czech Republic','Denmark','Estonia','Finland','France','Germany','Greece','Hungary','Ireland','Italy','Latvia','Lithuania','Luxembourg','Malta','Netherlands','Poland','Portugal','Romania','Slovakia','Slovenia','Spain','Sweden','United Kingdom']
      countries = File.read(File.join(Shoppe.root, 'db', 'countries.txt')).gsub(/\r/, "\n").split("\n").map { |c| c.split(/\t/) }
      countries.each do |code2, code3, name, continent, tld, currency|
        country = Country.new(:name => name, :code2 => code2, :code3 => code3, :continent => continent, :tld => tld.gsub('.', ''), :currency => currency)
        country.eu_member = true if eu_members.map(&:upcase).include?(name.upcase)
        country.save
      end
      
    end
  end
end

Version data entries

25 entries across 25 versions & 3 rubygems

Version Path
shoppe-1.1.2 lib/shoppe/country_importer.rb
shoppe-1.1.1 lib/shoppe/country_importer.rb
shoppe-1.1.0 lib/shoppe/country_importer.rb
shoppe-1.0.9 lib/shoppe/country_importer.rb
shoppe-1.0.8 lib/shoppe/country_importer.rb
kylekthompson-shoppe-1.0.7 lib/shoppe/country_importer.rb
shoppe-1.0.7 lib/shoppe/country_importer.rb
shoppe-1.0.6 lib/shoppe/country_importer.rb
shoppe-paypal-1.1.0 vendor/bundle/ruby/2.1.0/gems/shoppe-1.0.5/lib/shoppe/country_importer.rb
shoppe-1.0.5 lib/shoppe/country_importer.rb
shoppe-1.0.3 lib/shoppe/country_importer.rb
shoppe-1.0.2 lib/shoppe/country_importer.rb
shoppe-1.0.1 lib/shoppe/country_importer.rb
shoppe-1.0.0 lib/shoppe/country_importer.rb
shoppe-0.0.21 lib/shoppe/country_importer.rb
shoppe-0.0.20 lib/shoppe/country_importer.rb
shoppe-0.0.19 lib/shoppe/country_importer.rb
shoppe-0.0.18 lib/shoppe/country_importer.rb
shoppe-0.0.17 lib/shoppe/country_importer.rb
shoppe-0.0.16 lib/shoppe/country_importer.rb