This repository has been archived by the owner on Jan 4, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 9d54aa5
Showing
463 changed files
with
68,715 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
/.bundle/ | ||
/.yardoc | ||
/Gemfile.lock | ||
/_yardoc/ | ||
/coverage/ | ||
/doc/ | ||
/pkg/ | ||
/spec/reports/ | ||
/tmp/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
source 'https://rubygems.org' | ||
gem 'geocoder' | ||
gem 'retryable' | ||
gem 'tzinfo' | ||
# Specify your gem's dependencies in countries_data.gemspec | ||
gemspec |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2016 Russell Osborne | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# CountriesData | ||
|
||
This repo is an attempt to build a collection of meaningful country based data in yaml base format. We will commit derivations into json, and columar (per file). Our intent is make this repo programming language agnostic with well thought out data sets. | ||
|
||
## Installation | ||
|
||
Add this line to your application's Gemfile: | ||
|
||
```ruby | ||
gem 'countries_data' | ||
``` | ||
|
||
And then execute: | ||
|
||
$ bundle | ||
|
||
Or install it yourself as: | ||
|
||
$ gem install countries_data | ||
|
||
## Usage | ||
|
||
### With Ruby | ||
Use countries-rb gem! | ||
|
||
### With another language | ||
All external libraries should read files from the lib/countries_data/compiled_data folder. | ||
|
||
## Subdivisions | ||
|
||
## Administration Level Definitions | ||
This repo uses these definitions for subdivisions our current intent is only admin level 0 and 1. | ||
[Definitions](http://sedac.ciesin.columbia.edu/povmap/ds_defs_admin.jsp#888) | ||
|
||
## Development | ||
|
||
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment. | ||
|
||
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org). | ||
|
||
## Contributing | ||
|
||
Bug reports and pull requests are welcome on GitHub at https://github.com/rposborne/countries_data. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct. | ||
|
||
|
||
## License | ||
|
||
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT). | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
require "bundler/gem_tasks" | ||
|
||
ISO3166_ROOT_PATH = File.dirname(__FILE__) | ||
|
||
def country_path(alpha2) | ||
File.join(ISO3166_ROOT_PATH, 'lib', 'countries_data', 'local_data', 'countries', "#{alpha2}.yaml") | ||
end | ||
|
||
def load_country_yaml(alpha2) | ||
YAML.load_file(country_path(alpha2)) | ||
end | ||
|
||
def save_country_yaml(alpha2, data) | ||
File.open(country_path(alpha2), 'w+') { |f| f.write data.to_yaml } | ||
end | ||
|
||
def country_codes | ||
@country_codes ||= Dir['lib/countries_data/local_data/countries/*.yaml'].map { |x| File.basename(x, File.extname(x)) }.uniq | ||
end | ||
|
||
Dir.glob('lib/countries_data/tasks/*.rake').each { |r| load r } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#!/usr/bin/env ruby | ||
|
||
require "bundler/setup" | ||
require "countries_data" | ||
|
||
# You can add fixtures and/or initialization code here to make experimenting | ||
# with your gem easier. You can also use a different console, if you like. | ||
|
||
# (If you use this, don't forget to add pry to your Gemfile!) | ||
# require "pry" | ||
# Pry.start | ||
|
||
require "irb" | ||
IRB.start |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
IFS=$'\n\t' | ||
set -vx | ||
|
||
bundle install | ||
|
||
# Do any other automated setup that you need to do here |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# coding: utf-8 | ||
lib = File.expand_path('../lib', __FILE__) | ||
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) | ||
require 'countries_data' | ||
|
||
Gem::Specification.new do |spec| | ||
spec.name = "countries_data" | ||
spec.version = CountriesData::VERSION | ||
spec.authors = ["Russell Osborne"] | ||
spec.email = ["[email protected]"] | ||
|
||
spec.summary = %q{A collection of country specfic data} | ||
spec.homepage = "TODO: Put your gem's website or public repo URL here." | ||
spec.license = "MIT" | ||
|
||
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) } | ||
spec.bindir = "exe" | ||
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) } | ||
spec.require_paths = ["lib"] | ||
|
||
spec.add_development_dependency "bundler", "~> 1.11" | ||
spec.add_development_dependency "rake", "~> 10.0" | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
module CountriesData | ||
VERSION = '0.1.0'.freeze | ||
|
||
# The path that will be used for loading the Countries data. The | ||
# default location is __FILE__/../../../../data, which is where the data | ||
# lives in the gem installation of the mime-types-data library. | ||
# | ||
PATH = File.expand_path('countries/compiled_data', __FILE__) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
--- | ||
AD: | ||
continent: Europe | ||
alpha2: AD | ||
alpha3: AND | ||
country_code: '376' | ||
international_prefix: '00' | ||
ioc: AND | ||
gec: AN | ||
name: Andorra | ||
national_destination_code_lengths: | ||
- 2 | ||
national_number_lengths: | ||
- 6 | ||
- 7 | ||
- 8 | ||
- 9 | ||
national_prefix: None | ||
number: '020' | ||
region: Europe | ||
subregion: Southern Europe | ||
world_region: EMEA | ||
un_locode: AD | ||
nationality: Andorran | ||
postal_code: true | ||
unofficial_names: | ||
- Andorre | ||
- Andorra | ||
- "アンドラ" | ||
languages_official: | ||
- ca | ||
languages_spoken: | ||
- ca | ||
geo: | ||
latitude: 42.506285 | ||
latitude_dec: '42.5506591796875' | ||
longitude: 1.521801 | ||
longitude_dec: '1.5762332677841187' | ||
max_latitude: 42.6557909 | ||
max_longitude: 1.786639 | ||
min_latitude: 42.4287488 | ||
min_longitude: 1.4087051 | ||
bounds: | ||
northeast: | ||
lat: 42.6557909 | ||
lng: 1.786639 | ||
southwest: | ||
lat: 42.4287488 | ||
lng: 1.4087051 | ||
currency_code: EUR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
--- | ||
AE: | ||
continent: Asia | ||
address_format: |- | ||
{{recipient}} | ||
{{street}} | ||
{{postalcode}} {{city}} | ||
{{country}} | ||
alpha2: AE | ||
alpha3: ARE | ||
country_code: '971' | ||
international_prefix: '00' | ||
ioc: UAE | ||
gec: AE | ||
name: United Arab Emirates | ||
national_destination_code_lengths: | ||
- 2 | ||
national_number_lengths: | ||
- 7 | ||
- 8 | ||
- 9 | ||
national_prefix: '0' | ||
number: '784' | ||
region: Asia | ||
subregion: Western Asia | ||
world_region: EMEA | ||
un_locode: AE | ||
nationality: Emirian | ||
postal_code: false | ||
unofficial_names: | ||
- United Arab Emirates | ||
- "الإمارات العربية المتحدة" | ||
- Vereinigte Arabische Emirate | ||
- "Émirats Arabes Unis" | ||
- Emiratos Árabes Unidos | ||
- "アラブ首長国連邦" | ||
- Verenigde Arabische Emiraten | ||
languages_official: | ||
- ar | ||
languages_spoken: | ||
- ar | ||
geo: | ||
latitude: 23.424076 | ||
latitude_dec: '23.684776306152344' | ||
longitude: 53.847818 | ||
longitude_dec: '54.536643981933594' | ||
max_latitude: 26.069654 | ||
max_longitude: 56.3816785 | ||
min_latitude: 22.6315137 | ||
min_longitude: 51.497705 | ||
bounds: | ||
northeast: | ||
lat: 26.069654 | ||
lng: 56.3816785 | ||
southwest: | ||
lat: 22.6315137 | ||
lng: 51.497705 | ||
currency_code: AED |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
--- | ||
AF: | ||
continent: Asia | ||
alpha2: AF | ||
alpha3: AFG | ||
country_code: '93' | ||
international_prefix: '00' | ||
ioc: AFG | ||
gec: AF | ||
name: Afghanistan | ||
national_destination_code_lengths: | ||
- 2 | ||
national_number_lengths: | ||
- 8 | ||
- 9 | ||
national_prefix: '0' | ||
number: '004' | ||
region: Asia | ||
subregion: Southern Asia | ||
world_region: APAC | ||
un_locode: AF | ||
nationality: Afghan | ||
postal_code: true | ||
unofficial_names: | ||
- Afghanistan | ||
- Afganistán | ||
- "アフガニスタン" | ||
languages_official: | ||
- ps | ||
- uz | ||
- tk | ||
languages_spoken: | ||
- ps | ||
- uz | ||
- tk | ||
geo: | ||
latitude: 33.93911 | ||
latitude_dec: '33.833248138427734' | ||
longitude: 67.709953 | ||
longitude_dec: '66.02528381347656' | ||
max_latitude: 38.4908766 | ||
max_longitude: 74.889862 | ||
min_latitude: 29.3772 | ||
min_longitude: 60.5170004 | ||
bounds: | ||
northeast: | ||
lat: 38.4908766 | ||
lng: 74.889862 | ||
southwest: | ||
lat: 29.3772 | ||
lng: 60.5170004 | ||
currency_code: AFN |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
--- | ||
AG: | ||
continent: North America | ||
alpha2: AG | ||
alpha3: ATG | ||
country_code: '1' | ||
international_prefix: '011' | ||
ioc: ANT | ||
gec: AC | ||
name: Antigua and Barbuda | ||
national_destination_code_lengths: | ||
- 3 | ||
national_number_lengths: | ||
- 10 | ||
national_prefix: '1' | ||
number: 028 | ||
region: Americas | ||
subregion: Caribbean | ||
world_region: AMER | ||
un_locode: AG | ||
nationality: Antiguan, Barbudan | ||
postal_code: false | ||
unofficial_names: | ||
- Antigua and Barbuda | ||
- Antigua und Barbuda | ||
- Antigua et Barbuda | ||
- Antigua y Barbuda | ||
- "アンティグア・バーブーダ" | ||
- Antigua en Barbuda | ||
languages_official: | ||
- en | ||
languages_spoken: | ||
- en | ||
geo: | ||
latitude: 17.060816 | ||
latitude_dec: '17.09273910522461' | ||
longitude: -61.796428 | ||
longitude_dec: "-61.81040954589844" | ||
max_latitude: 17.7291867 | ||
max_longitude: -61.6571681 | ||
min_latitude: 16.932532 | ||
min_longitude: -62.3476571 | ||
bounds: | ||
northeast: | ||
lat: 17.7291867 | ||
lng: -61.6571681 | ||
southwest: | ||
lat: 16.932532 | ||
lng: -62.3476571 | ||
currency_code: XCD |
Oops, something went wrong.