public
Fork of ptb/country_codes
Description: The Country Codes plugin finds and converts between country information as described in ISO 3166-1; forked from ptb's version and added Contient information.
Homepage: http://blog.orez.us/chyrp/?action=tag&name=countrycodes
Clone URL: git://github.com/itszero/country_codes_with_contient.git
Click here to lend your support to: country_codes_with_contient and make a donation at www.pledgie.com !
name age message
file CHANGELOG Loading commit data...
file MIT-LICENSE Mon Dec 17 01:46:49 -0800 2007 Adding plugin with tests git-svn-id: http://op... [JamesBrooks]
file README
file Rakefile Mon Dec 17 01:46:49 -0800 2007 Adding plugin with tests git-svn-id: http://op... [JamesBrooks]
file init.rb Mon Dec 17 01:46:49 -0800 2007 Adding plugin with tests git-svn-id: http://op... [JamesBrooks]
directory lib/ Mon Nov 17 04:17:52 -0800 2008 Added contient information [zero]
directory test/ Mon Dec 17 18:20:26 -0800 2007 Added countries_for_select method and tests gi... [JamesBrooks]
README
CountryCodesWithContient
============

This plugin provides an easy to access collection of ISO 3166-1, codes for the representation of names of countries and 
their subdivisions.
Contains the following from ISO 3166-1:
  
  * ISO 3166-1 alpha-2, a two-letter system, used in many applications, most prominently for
    country code top-level domains (ccTLDs), with some exceptions.
    
  * ISO 3166-1 alpha-3, a three-letter system, which allows a better visual association between
    country name and code element than the alpha-2 code.
    
  * ISO 3166-1 numeric, a three-digit numerical system, with the advantage of script (writing system)
    independence, and hence useful for people or systems which uses a non-Latin script. This is
    identicalto codes defined by the United Nations Statistics Division.

** In this fork, you can get contient information, too.

Why
======
Since I'm working on an e-commerce website, and I found that most of international shipping method's price is based on 
the geographic areas. To be exactly, the contient(For example, the Taiwan's Post Office). So I modified the original 
plugin to return the contient information as well. The data is extracted from the Wikipedia with some manual 
modification to match both. For those who don't use the contient information, I suggest you can use the original plugin 
"CountryCodes", since its data size is smaller, let your rails application load faster.

Example
=======

Find a country by name and retrieve information about it (alpha-2, alpha-3 and numeric):

  australia = CountryCodes.find_by_name('Australia')
  australia[:name]     # yields 'Australia'
  australia[:a2]       # yields 'au'
  australia[:a3]       # yields 'aus'
  australia[:numeric]  # yields 36
  australia[:contient] # yields 'OC'
  
  
Likewise countries can be found using any of the provides attributes (name, a2, a3 or numeric), such as:

  CountryCodes.find_by_a2['au'][:name]  # yields 'Australia'


Search conditions are case-insensitive.



Original copyright (c) 2007 James Brooks (http://blog.whitet.net), released under the MIT license
Copyright (c) 2008 Zero Cho (http://blog.orez.us/), released under the MIT license, too.
Contient data is extracted from "http://en.wikipedia.org/wiki/List_of_countries_by_continent_(data_file)"