simple-countries 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +88 -11
- data/lib/simple/countries/version.rb +1 -1
- data/lib/simple/countries.yml +3 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f8242745f4aab7451f8518a04bfaaf400cd3b98
|
4
|
+
data.tar.gz: 7e8f73392497e20ffc04a57fd427f1a50f070a9d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ecc80f72129da2b3f64f8d31a7b752694b08c384080a4acf6985a3eb8ecf54bd3c68dcec7f17fce5155b8838cc73f2c34c4f0a672804aab250a3cfc17667fd41
|
7
|
+
data.tar.gz: 9f9648d97e7a33b010906539ed8c0da907214a848768eb48982645acdd37145d7b762ed9ff61367143d233b55b10914cfc80ce48562ed1c02b6aab448f2c54b8
|
data/README.md
CHANGED
@@ -1,8 +1,5 @@
|
|
1
|
-
# Simple
|
2
|
-
|
3
|
-
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/simple/countries`. To experiment with that code, run `bin/console` for an interactive prompt.
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
1
|
+
# Simple Countries
|
2
|
+
A list of all countries for Rails
|
6
3
|
|
7
4
|
## Installation
|
8
5
|
|
@@ -21,19 +18,99 @@ Or install it yourself as:
|
|
21
18
|
$ gem install simple-countries
|
22
19
|
|
23
20
|
## Usage
|
21
|
+
Simple Method :
|
22
|
+
|
23
|
+
- Get All
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
Simple::Countries.all
|
27
|
+
```
|
28
|
+
- Find
|
29
|
+
|
30
|
+
```ruby
|
31
|
+
Simple::Countries.find(2)
|
32
|
+
```
|
33
|
+
return `` {:id=>2, :alias=>"AL", :name=>"Albania"} ``
|
34
|
+
|
35
|
+
- Get first country
|
36
|
+
|
37
|
+
```ruby
|
38
|
+
Simple::Countries.first
|
39
|
+
```
|
40
|
+
return `` {:id=>1, :alias=>"AF", :name=>"Afghanistan"} ``
|
41
|
+
|
42
|
+
- Get last country
|
43
|
+
|
44
|
+
```ruby
|
45
|
+
Simple::Countries.last
|
46
|
+
```
|
47
|
+
return `` {:id=>241, :alias=>"ZW", :name=>"Zimbabwe"} ``
|
48
|
+
|
49
|
+
- Find by Alias
|
50
|
+
|
51
|
+
```ruby
|
52
|
+
Simple::Countries.find_by_alias('AF')
|
53
|
+
```
|
54
|
+
return `` Afghanistan ``
|
55
|
+
|
56
|
+
- Search
|
57
|
+
|
58
|
+
```ruby
|
59
|
+
Simple::Countries.search('A')
|
60
|
+
```
|
61
|
+
return a array :
|
62
|
+
```ruby
|
63
|
+
[["AF", "Afghanistan"], ["AL", "Albania"], ["DZ", "Algeria"], ["AS", "American Samoa"], ["AD", "Andorra"], ["AO", "Angola"], ["AI", "Anguilla"], ["AQ", "Antarctica"], ["AG", "Antigua And Barbuda"], ["AR", "Argentina"], ["AM", "Armenia"], ["AW", "Aruba"], ["AU", "Australia"], ["AT", "Austria"], ["AZ", "Azerbaijan"], ["BA", "Bosnia And Herzegovina"], ["CF", "Central African Republic"], ["HM", "Heard Island And Mcdonald Islands"], ["LY", "Libyan Arab Jamahiriya"], ["AN", "Netherlands Antilles"], ["KN", "Saint Kitts And Nevis"], ["PM", "Saint Pierre And Miquelon"], ["VC", "Saint Vincent And The Grenadines"], ["ST", "Sao Tome And Principe"], ["SA", "Saudi Arabia"], ["ZA", "South Africa"], ["GS", "South Georgia And The South Sandwich Islands"], ["SJ", "Svalbard And Jan Mayen"], ["SY", "Syrian Arab Republic"], ["TT", "Trinidad And Tobago"], ["TC", "Turks And Caicos Islands"], ["AE", "United Arab Emirates"], ["WF", "Wallis And Futuna"]]
|
64
|
+
```
|
65
|
+
|
66
|
+
- Search by alias
|
67
|
+
|
68
|
+
```ruby
|
69
|
+
Simple::Countries.search_by_key('A')
|
70
|
+
```
|
71
|
+
return a array :
|
72
|
+
|
73
|
+
```ruby
|
74
|
+
["AF", "AL", "AS", "AD", "AO", "AI", "AQ", "AG", "AR", "AM", "AW", "AU", "AT", "AZ", "BA", "CA", "GA", "VA", "LA", "MA", "NA", "AN", "PA", "QA", "SA", "ZA", "UA", "AE"]
|
75
|
+
```
|
76
|
+
|
77
|
+
- Has alias in list countries
|
78
|
+
|
79
|
+
```ruby
|
80
|
+
Simple::Countries.has_key?('wf')
|
81
|
+
```
|
82
|
+
return `` false ``
|
83
|
+
|
84
|
+
```ruby
|
85
|
+
Simple::Countries.has_key?('WF')
|
86
|
+
```
|
87
|
+
return `` true ``
|
88
|
+
|
89
|
+
- Get all Alias in list countries
|
24
90
|
|
25
|
-
|
91
|
+
```ruby
|
92
|
+
Simple::Countries.alias
|
93
|
+
```
|
94
|
+
return array of alias
|
26
95
|
|
27
|
-
|
96
|
+
```ruby
|
97
|
+
["AF", "AL", "DZ", "AS", "AD", "AO", "AI", "AQ", "AG", "AR", "AM", "AW", "AU", "AT", "AZ", "BS", "BH", "BD", "BB", "BY", "BE", "BZ", "BJ", "BM", "BT", "BO", "BA", "BW", "BV", "BR", "IO", "BN", "BG", "BF", "BI", "KH", "CM", "CA", "CV", "KY", "CF", "TD", "CL", "CN", "CX", "CC", "CO", "KM", "CG", "CD", "CK", "CR", "CI", "HR", "CU", "CY", "CZ", "DK", "DJ", "DM", "DO", "TP", "EC", "EG", "SV", "GQ", "ER", "EE", "ET", "FK", "FO", "FJ", "FI", "FR", "GF", "PF", "TF", "GA", "GM", "GE", "DE", "GH", "GI", "GR", "GL", "GD", "GP", "GU", "GT", "GN", "GW", "GY", "HT", "HM", "VA", "HN", "HK", "HU", "IS", "IN", "ID", "IR", "IQ", "IE", "IL", "IT", "JM", "JP", "JO", "KZ", "KE", "KI", "KP", "KR", "KV", "KW", "KG", "LA", "LV", "LB", "LS", "LR", "LY", "LI", "LT", "LU", "MO", "MK", "MG", "MW", "MY", "MV", "ML", "MT", "MH", "MQ", "MR", "MU", "YT", "MX", "FM", "MD", "MC", "MN", "MS", "ME", "MA", "MZ", "MM", "NA", "NR", "NP", "NL", "AN", "NC", "NZ", "NI", "NE", "NG", "NU", "NF", "MP", "NO", "OM", "PK", "PW", "PS", "PA", "PG", "PY", "PE", "PH", "PN", "PL", "PT", "PR", "QA", "RE", "RO", "RU", "RW", "SH", "KN", "LC", "PM", "VC", "WS", "SM", "ST", "SA", "SN", "RS", "SC", "SL", "SG", "SK", "SI", "SB", "SO", "ZA", "GS", "ES", "LK", "SD", "SR", "SJ", "SZ", "SE", "CH", "SY", "TW", "TJ", "TZ", "TH", "TG", "TK", "TO", "TT", "TN", "TR", "TM", "TC", "TV", "UG", "UA", "AE", "GB", "US", "UM", "UY", "UZ", "VU", "VE", "VN", "VG", "VI", "WF", "EH", "YE", "ZM", "ZW"]
|
98
|
+
```
|
28
99
|
|
29
|
-
|
100
|
+
- Get all name of list countries
|
30
101
|
|
31
|
-
|
102
|
+
```ruby
|
103
|
+
Simple::Countries.name
|
104
|
+
```
|
105
|
+
return a array of name
|
32
106
|
|
33
|
-
|
107
|
+
```ruby
|
108
|
+
["Afghanistan", "Albania", "Algeria", "American Samoa", "Andorra", "Angola", "Anguilla", "Antarctica", "Antigua And Barbuda", "Argentina", "Armenia", "Aruba", "Australia", "Austria", "Azerbaijan", "Bahamas", "Bahrain", "Bangladesh", "Barbados", "Belarus", "Belgium", "Belize", "Benin", "Bermuda", "Bhutan", "Bolivia", "Bosnia And Herzegovina", "Botswana", "Bouvet Island", "Brazil", "British Indian Ocean Territory", "Brunei Darussalam", "Bulgaria", "Burkina Faso", "Burundi", "Cambodia", "Cameroon", "Canada", "Cape Verde", "Cayman Islands", "Central African Republic", "Chad", "Chile", "China", "Christmas Island", "Cocos (keeling) Islands", "Colombia", "Comoros", "Congo", "Congo, The Democratic Republic Of The", "Cook Islands", "Costa Rica", "Cote D'ivoire", "Croatia", "Cuba", "Cyprus", "Czech Republic", "Denmark", "Djibouti", "Dominica", "Dominican Republic", "East Timor", "Ecuador", "Egypt", "El Salvador", "Equatorial Guinea", "Eritrea", "Estonia", "Ethiopia", "Falkland Islands (malvinas)", "Faroe Islands", "Fiji", "Finland", "France", "French Guiana", "French Polynesia", "French Southern Territories", "Gabon", "Gambia", "Georgia", "Germany", "Ghana", "Gibraltar", "Greece", "Greenland", "Grenada", "Guadeloupe", "Guam", "Guatemala", "Guinea", "Guinea-bissau", "Guyana", "Haiti", "Heard Island And Mcdonald Islands", "Holy See (vatican City State)", "Honduras", "Hong Kong", "Hungary", "Iceland", "India", "Indonesia", "Iran, Islamic Republic Of", "Iraq", "Ireland", "Israel", "Italy", "Jamaica", "Japan", "Jordan", "Kazakstan", "Kenya", "Kiribati", "Korea, Democratic People's Republic Of", "Korea, Republic Of", "Kosovo", "Kuwait", "Kyrgyzstan", "Lao People's Democratic Republic", "Latvia", "Lebanon", "Lesotho", "Liberia", "Libyan Arab Jamahiriya", "Liechtenstein", "Lithuania", "Luxembourg", "Macau", "Macedonia, The Former Yugoslav Republic Of", "Madagascar", "Malawi", "Malaysia", "Maldives", "Mali", "Malta", "Marshall Islands", "Martinique", "Mauritania", "Mauritius", "Mayotte", "Mexico", "Micronesia, Federated States Of", "Moldova, Republic Of", "Monaco", "Mongolia", "Montserrat", "Montenegro", "Morocco", "Mozambique", "Myanmar", "Namibia", "Nauru", "Nepal", "Netherlands", "Netherlands Antilles", "New Caledonia", "New Zealand", "Nicaragua", "Niger", "Nigeria", "Niue", "Norfolk Island", "Northern Mariana Islands", "Norway", "Oman", "Pakistan", "Palau", "Palestinian Territory, Occupied", "Panama", "Papua New Guinea", "Paraguay", "Peru", "Philippines", "Pitcairn", "Poland", "Portugal", "Puerto Rico", "Qatar", "Reunion", "Romania", "Russian Federation", "Rwanda", "Saint Helena", "Saint Kitts And Nevis", "Saint Lucia", "Saint Pierre And Miquelon", "Saint Vincent And The Grenadines", "Samoa", "San Marino", "Sao Tome And Principe", "Saudi Arabia", "Senegal", "Serbia", "Seychelles", "Sierra Leone", "Singapore", "Slovakia", "Slovenia", "Solomon Islands", "Somalia", "South Africa", "South Georgia And The South Sandwich Islands", "Spain", "Sri Lanka", "Sudan", "Suriname", "Svalbard And Jan Mayen", "Swaziland", "Sweden", "Switzerland", "Syrian Arab Republic", "Taiwan, Province Of China", "Tajikistan", "Tanzania, United Republic Of", "Thailand", "Togo", "Tokelau", "Tonga", "Trinidad And Tobago", "Tunisia", "Turkey", "Turkmenistan", "Turks And Caicos Islands", "Tuvalu", "Uganda", "Ukraine", "United Arab Emirates", "United Kingdom", "United States", "United States Minor Outlying Islands", "Uruguay", "Uzbekistan", "Vanuatu", "Venezuela", "Viet Nam", "Virgin Islands, British", "Virgin Islands, U.s.", "Wallis And Futuna", "Western Sahara", "Yemen", "Zambia", "Zimbabwe"]
|
109
|
+
```
|
34
110
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/simple-countries. 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.
|
36
111
|
|
112
|
+
## Checkout on Rubygems.org
|
113
|
+
https://rubygems.org/gems/simple-countries
|
37
114
|
|
38
115
|
## License
|
39
116
|
|
data/lib/simple/countries.yml
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: simple-countries
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Quan Nguyen
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-08-
|
11
|
+
date: 2016-08-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|