turkish_cities 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +8 -1
- data/CHANGELOG.md +14 -3
- data/CONTRIBUTING.md +38 -0
- data/Gemfile.lock +6 -6
- data/README.md +39 -7
- data/lib/turkish_cities/city.rb +47 -17
- data/lib/turkish_cities/data/cities.yaml +82 -1
- data/lib/turkish_cities/version.rb +1 -1
- data/lib/turkish_cities.rb +9 -1
- data/turkish_cities.gemspec +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d989f10ad83bcdcb075741115677daca3be317e0030d5dc4b265273e9a5fbeb9
|
4
|
+
data.tar.gz: 23a660a74d9708b27b297ce71f6d2627c74a0af99d976c182432df3ffc5de331
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e0a364e8d251692bf4c98792f02b26a8765b24321e7c0054c6a003055f63808903b82fd2271c4244364407f040e5f41058abe29f9a4ce100f3e25478a13c596
|
7
|
+
data.tar.gz: 1f62992e4e054526f1a1b396c6c0c3e2d23eda86024e0faa93024e3a26737ecdc95d4d23d9a23caea83c3a93882e3ab5a5b2864157f28edc338e291b398546a0
|
data/.rubocop.yml
CHANGED
@@ -5,10 +5,18 @@ AllCops:
|
|
5
5
|
- 'turkish_cities.gemspec'
|
6
6
|
Layout/LineLength:
|
7
7
|
Max: 100
|
8
|
+
Layout/SpaceAroundMethodCallOperator:
|
9
|
+
Enabled: true
|
10
|
+
Lint/RaiseException:
|
11
|
+
Enabled: true
|
12
|
+
Lint/StructNewOverride:
|
13
|
+
Enabled: true
|
8
14
|
Metrics/BlockLength:
|
9
15
|
ExcludedMethods: ['describe', 'context']
|
10
16
|
Style/Documentation:
|
11
17
|
Enabled: false
|
18
|
+
Style/ExponentialNotation:
|
19
|
+
Enabled: true
|
12
20
|
Style/HashEachMethods:
|
13
21
|
Enabled: true
|
14
22
|
Style/HashTransformKeys:
|
@@ -17,4 +25,3 @@ Style/HashTransformKeys:
|
|
17
25
|
Style/HashTransformValues:
|
18
26
|
Description: 'Prefer `transform_values` over `each_with_object` and `map`.'
|
19
27
|
Enabled: true
|
20
|
-
|
data/CHANGELOG.md
CHANGED
@@ -1,18 +1,29 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 0.1.3 (2020-04-20)
|
4
|
+
|
5
|
+
### New features
|
6
|
+
|
7
|
+
* [#22](https://github.com/sarslanoglu/turkish_cities/issues/22): Add region data to cities.yaml and update ```list_cities``` method to support regions
|
8
|
+
* [#20](https://github.com/sarslanoglu/turkish_cities/issues/20): Add city finding with phone code and vice versa. ```find_name_by_phone_code``` and ```find_phone_code_by_name``` methods are added
|
9
|
+
|
10
|
+
### Bug fixes
|
11
|
+
|
12
|
+
* [#18](https://github.com/sarslanoglu/turkish_cities/issues/18): Fix yaml file read error while deploying apps to Heroku
|
13
|
+
|
3
14
|
## 0.1.2 (2020-04-13)
|
4
15
|
|
5
16
|
### New features
|
6
17
|
|
7
|
-
* [#
|
18
|
+
* [#3](https://github.com/sarslanoglu/turkish_cities/issues/3): Change city_list data to yaml file format
|
8
19
|
|
9
20
|
### Bug fixes
|
10
21
|
|
11
|
-
* [#
|
22
|
+
* [#2](https://github.com/sarslanoglu/turkish_cities/issues/2): Fix capital Turkish characters bug on cities with capital 'I' letter
|
12
23
|
|
13
24
|
### Changes
|
14
25
|
|
15
|
-
* [#
|
26
|
+
* [#15](https://github.com/sarslanoglu/turkish_cities/issues/15): Handle error messages at ```find_name_by_plate_number``` and ```find_plate_number_by_name``` methods
|
16
27
|
|
17
28
|
## 0.1.1 (2020-03-31)
|
18
29
|
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# Contributing
|
2
|
+
|
3
|
+
If you discover issues, have ideas for improvements or new features,
|
4
|
+
please report them to the [issue tracker][1] of the repository or
|
5
|
+
submit a pull request. Please, try to follow these guidelines when you
|
6
|
+
do so.
|
7
|
+
|
8
|
+
## Guidelines
|
9
|
+
|
10
|
+
* Read [how to properly contribute to open source projects on GitHub][2].
|
11
|
+
* Fork the project.
|
12
|
+
* Write [good commit messages][3].
|
13
|
+
* Use the same coding conventions as the rest of the project.
|
14
|
+
* Commit and push until you are happy with your contribution.
|
15
|
+
* Make sure to add tests for it.
|
16
|
+
* Add an entry to the [Changelog](CHANGELOG.md) accordingly. See [changelog entry format](#changelog-entry-format).
|
17
|
+
* Make sure the test suite is passing and the code you wrote doesn't produce RuboCop offenses.
|
18
|
+
* [Squash related commits together][4].
|
19
|
+
|
20
|
+
### Changelog entry format
|
21
|
+
|
22
|
+
Here are a few examples:
|
23
|
+
|
24
|
+
```
|
25
|
+
* [#11](https://github.com/sarslanoglu/turkish_cities/pull/11): Change city_list data to yaml file format
|
26
|
+
* [#6](https://github.com/sarslanoglu/turkish_cities/pull/6): Fix capital Turkish characters bug on cities with capital 'I' letter
|
27
|
+
* [#16](https://github.com/sarslanoglu/turkish_cities/pull/16): Handle error messages at ```find_name_by_plate_number``` and ```find_plate_number_by_name``` methods
|
28
|
+
```
|
29
|
+
|
30
|
+
* Mark it up in [Markdown syntax][5].
|
31
|
+
* The entry line should start with `* ` (an asterisk and a space).
|
32
|
+
* If the change has a related GitHub issue (e.g. a bug fix for a reported issue), put a link to the issue as `[#11](https://github.com/sarslanoglu/turkish_cities/issues/11): `.
|
33
|
+
|
34
|
+
[1]: https://github.com/sarslanoglu/turkish_cities/issues
|
35
|
+
[2]: https://www.gun.io/blog/how-to-github-fork-branch-and-pull-request
|
36
|
+
[3]: https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
|
37
|
+
[4]: http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html
|
38
|
+
[5]: https://daringfireball.net/projects/markdown/syntax
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
turkish_cities (0.1.
|
4
|
+
turkish_cities (0.1.3)
|
5
5
|
i18n (>= 0.6.4, <= 2)
|
6
6
|
|
7
7
|
GEM
|
@@ -22,7 +22,7 @@ GEM
|
|
22
22
|
jaro_winkler (1.5.4)
|
23
23
|
json (2.3.0)
|
24
24
|
parallel (1.19.1)
|
25
|
-
parser (2.7.1.
|
25
|
+
parser (2.7.1.1)
|
26
26
|
ast (~> 2.4.0)
|
27
27
|
rainbow (3.0.0)
|
28
28
|
rexml (3.2.4)
|
@@ -39,14 +39,14 @@ GEM
|
|
39
39
|
diff-lcs (>= 1.2.0, < 2.0)
|
40
40
|
rspec-support (~> 3.9.0)
|
41
41
|
rspec-support (3.9.2)
|
42
|
-
rubocop (0.
|
42
|
+
rubocop (0.82.0)
|
43
43
|
jaro_winkler (~> 1.5.1)
|
44
44
|
parallel (~> 1.10)
|
45
45
|
parser (>= 2.7.0.1)
|
46
46
|
rainbow (>= 2.2.2, < 4.0)
|
47
47
|
rexml
|
48
48
|
ruby-progressbar (~> 1.7)
|
49
|
-
unicode-display_width (>= 1.4.0, <
|
49
|
+
unicode-display_width (>= 1.4.0, < 2.0)
|
50
50
|
ruby-progressbar (1.10.1)
|
51
51
|
simplecov (0.16.1)
|
52
52
|
docile (~> 1.1)
|
@@ -59,7 +59,7 @@ GEM
|
|
59
59
|
thor (1.0.1)
|
60
60
|
tins (1.24.1)
|
61
61
|
sync
|
62
|
-
unicode-display_width (1.
|
62
|
+
unicode-display_width (1.7.0)
|
63
63
|
|
64
64
|
PLATFORMS
|
65
65
|
ruby
|
@@ -68,7 +68,7 @@ DEPENDENCIES
|
|
68
68
|
bundler (~> 2.1.4)
|
69
69
|
coveralls (~> 0.8.23)
|
70
70
|
rspec (~> 3.9.0)
|
71
|
-
rubocop (~> 0.
|
71
|
+
rubocop (~> 0.82.0)
|
72
72
|
turkish_cities!
|
73
73
|
|
74
74
|
BUNDLED WITH
|
data/README.md
CHANGED
@@ -49,6 +49,22 @@ TurkishCities.find_name_by_plate_number('78') # => "Karabük"
|
|
49
49
|
TurkishCities.find_name_by_plate_number(100) # => 'Given value [100] is outside bounds of 1 to 81.'
|
50
50
|
```
|
51
51
|
|
52
|
+
### Finding city name by phone code
|
53
|
+
|
54
|
+
There are 81 cities in Turkey. By calling a phone code between 212-488 will give city_name. All phone codes are even sending odd number will give error without searching
|
55
|
+
|
56
|
+
```ruby
|
57
|
+
TurkishCities.find_name_by_phone_code(312) # => "Ankara"
|
58
|
+
TurkishCities.find_name_by_phone_code(242) # => "Antalya"
|
59
|
+
TurkishCities.find_name_by_phone_code(000222) # => "Eskişehir"
|
60
|
+
TurkishCities.find_name_by_phone_code(274.0) # => "Kütahya"
|
61
|
+
TurkishCities.find_name_by_phone_code('212') # => "İstanbul"
|
62
|
+
TurkishCities.find_name_by_phone_code(216) # => "İstanbul"
|
63
|
+
TurkishCities.find_name_by_phone_code(360) # => 'Couldn't find city name with phone code 360'
|
64
|
+
TurkishCities.find_name_by_phone_code(0) # => 'Given value [0] is outside bounds of 212 to 488.'
|
65
|
+
TurkishCities.find_name_by_phone_code(213) # => 'Given value [213] must be an even number.'
|
66
|
+
```
|
67
|
+
|
52
68
|
### Finding plate number by city name
|
53
69
|
|
54
70
|
City name can be given case and turkish character insensitive
|
@@ -57,10 +73,24 @@ City name can be given case and turkish character insensitive
|
|
57
73
|
TurkishCities.find_plate_number_by_name('Ankara') # => 6
|
58
74
|
TurkishCities.find_plate_number_by_name('Eskişehir') # => 26
|
59
75
|
TurkishCities.find_plate_number_by_name('Canakkale') # => 17
|
76
|
+
TurkishCities.find_plate_number_by_name('Istanbul') # => 34
|
60
77
|
TurkishCities.find_plate_number_by_name('kirsehir') # => 40
|
61
78
|
TurkishCities.find_plate_number_by_name('falansehir') # => "Couldn't find city name with 'falansehir'"
|
62
79
|
```
|
63
80
|
|
81
|
+
### Finding phone number by city name
|
82
|
+
|
83
|
+
City name can be given case and turkish character insensitive
|
84
|
+
|
85
|
+
```ruby
|
86
|
+
TurkishCities.find_phone_code_by_name('Ankara') # => 312
|
87
|
+
TurkishCities.find_phone_code_by_name('Eskişehir') # => 222
|
88
|
+
TurkishCities.find_phone_code_by_name('Canakkale') # => 286
|
89
|
+
TurkishCities.find_phone_code_by_name('Istanbul') # => [212, 216]
|
90
|
+
TurkishCities.find_phone_code_by_name('kirsehir') # => 386
|
91
|
+
TurkishCities.find_phone_code_by_name('filansehir') # => "Couldn't find city name with 'filansehir'"
|
92
|
+
```
|
93
|
+
|
64
94
|
### Listing all cities
|
65
95
|
|
66
96
|
By default cities will be listed by their plate number ascending.
|
@@ -69,13 +99,19 @@ By default cities will be listed by their plate number ascending.
|
|
69
99
|
TurkishCities.list_cities # => ["Adana", "Adıyaman" ... "Kilis", "Osmaniye", "Düzce"]
|
70
100
|
```
|
71
101
|
|
72
|
-
While listing cities
|
102
|
+
While listing cities three additional parameters can be send ```alphabetically_sorted```, ```metropolitan_municipality``` and ```region```. All parameters can be send seperately and together.
|
73
103
|
|
74
104
|
```ruby
|
75
105
|
TurkishCities.list_cities({ alphabetically_sorted: true })
|
76
106
|
# => ["Adana", "Adıyaman" ... "Yalova", "Yozgat", "Zonguldak"]
|
77
107
|
TurkishCities.list_cities({ metropolitan_municipality: true })
|
78
108
|
# => ["Adana", "Ankara" ... "Trabzon", "Şanlıurfa", "Van"]
|
109
|
+
TurkishCities.list_cities({ region: 'Karadeniz' })
|
110
|
+
# => ["Amasya", "Artvin" ... "Bartın", "Karabük", "Düzce"]
|
111
|
+
TurkishCities.list_cities({ alphabetically_sorted: true, region: 'Karadeniz' })
|
112
|
+
# => ["Amasya", "Artvin" ... "Tokat", "Trabzon", "Zonguldak"]
|
113
|
+
TurkishCities.list_cities({ metropolitan_municipality: true, region: 'Karadeniz' })
|
114
|
+
# => ["Ordu", "Samsun", "Trabzon"]
|
79
115
|
TurkishCities.list_cities({ alphabetically_sorted: true, metropolitan_municipality: true })
|
80
116
|
# => ["Adana", "Ankara" ... "Tekirdağ", "Trabzon", "Van"]
|
81
117
|
```
|
@@ -90,15 +126,11 @@ TurkishCities.list_cities({ alphabetically_sorted: true, metropolitan_municipali
|
|
90
126
|
|
91
127
|
## Contributing
|
92
128
|
|
93
|
-
|
94
|
-
2. Create your feature branch (`git checkout -b my-new-feature`)
|
95
|
-
3. Commit your changes (`git commit -am 'Add some feature'`)
|
96
|
-
4. Push to the branch (`git push origin my-new-feature`)
|
97
|
-
5. Create new Pull Request
|
129
|
+
Contributing guidelines are available [here](CONTRIBUTING.md).
|
98
130
|
|
99
131
|
## Changelog
|
100
132
|
|
101
|
-
|
133
|
+
Changelog is available [here](CHANGELOG.md).
|
102
134
|
|
103
135
|
## Copyright
|
104
136
|
|
data/lib/turkish_cities/city.rb
CHANGED
@@ -6,45 +6,75 @@ require 'yaml'
|
|
6
6
|
class City
|
7
7
|
I18n.enforce_available_locales = false
|
8
8
|
|
9
|
-
|
9
|
+
file_path = File.join(File.dirname(__FILE__), 'data/cities.yaml')
|
10
|
+
CITY_LIST = YAML.load_file(file_path)
|
10
11
|
|
11
12
|
def find_by_id(plate_number)
|
12
|
-
|
13
|
-
raise RangeError, "Given value [#{plate_number}] is outside bounds of 1 to 81."
|
14
|
-
end
|
13
|
+
check_input_range(plate_number, 1, 81)
|
15
14
|
|
16
15
|
CITY_LIST.each do |city|
|
17
16
|
return city['name'] if city['plate_number'] == plate_number.to_i
|
18
17
|
end
|
19
18
|
end
|
20
19
|
|
21
|
-
def
|
20
|
+
def find_by_phone_code(phone_code)
|
21
|
+
check_input_range(phone_code, 212, 488)
|
22
|
+
check_phone_code(phone_code)
|
23
|
+
|
22
24
|
CITY_LIST.each do |city|
|
23
|
-
if
|
24
|
-
return city['
|
25
|
+
if city['phone_code'].is_a?(Array)
|
26
|
+
return city['name'] if city['phone_code'].include?(phone_code.to_i)
|
27
|
+
elsif city['phone_code'] == phone_code.to_i
|
28
|
+
return city['name']
|
25
29
|
end
|
26
30
|
end
|
27
|
-
"Couldn't find city name with
|
31
|
+
"Couldn't find city name with phone code #{phone_code}"
|
28
32
|
end
|
29
33
|
|
30
|
-
def
|
31
|
-
|
32
|
-
|
33
|
-
city
|
34
|
+
def find_by_name(city_name, return_type)
|
35
|
+
CITY_LIST.each do |city|
|
36
|
+
if convert_chars(city['name']) == convert_chars(city_name)
|
37
|
+
return return_type == 'plate_number' ? city['plate_number'] : city['phone_code']
|
34
38
|
end
|
35
|
-
city_list
|
36
|
-
else
|
37
|
-
city_list = CITY_LIST
|
38
39
|
end
|
40
|
+
"Couldn't find city name with '#{city_name}'"
|
41
|
+
end
|
42
|
+
|
43
|
+
def list_cities(options)
|
44
|
+
city_list = CITY_LIST
|
45
|
+
|
46
|
+
city_list = filter_metropolitan_municipalities(city_list) if options[:metropolitan_municipality]
|
47
|
+
city_list = filter_regions(city_list, options[:region]) if options[:region]
|
39
48
|
|
40
|
-
final_city_list = prepare_city_list(city_list
|
49
|
+
final_city_list = prepare_city_list(city_list)
|
41
50
|
options[:alphabetically_sorted] ? sort_cities(final_city_list) : final_city_list
|
42
51
|
end
|
43
52
|
|
44
53
|
private
|
45
54
|
|
55
|
+
def check_input_range(input, min, max)
|
56
|
+
return if input.to_i.between?(min, max)
|
57
|
+
|
58
|
+
raise RangeError, "Given value [#{input}] is outside bounds of #{min} to #{max}."
|
59
|
+
end
|
60
|
+
|
61
|
+
def check_phone_code(input)
|
62
|
+
return if input.to_i.even?
|
63
|
+
|
64
|
+
raise ArgumentError, "Given value [#{input}] must be an even number."
|
65
|
+
end
|
66
|
+
|
46
67
|
def convert_chars(string)
|
47
|
-
I18n.transliterate(string)
|
68
|
+
I18n.transliterate(string.downcase(:turkic))
|
69
|
+
end
|
70
|
+
|
71
|
+
def filter_metropolitan_municipalities(city_list)
|
72
|
+
city_list.map { |city| city unless city['metropolitan_municipality_since'].nil? }.compact
|
73
|
+
end
|
74
|
+
|
75
|
+
def filter_regions(city_list, region)
|
76
|
+
region = convert_chars(region.to_s)
|
77
|
+
city_list.map { |city| city if convert_chars(city['region']) == region }.compact
|
48
78
|
end
|
49
79
|
|
50
80
|
def prepare_city_list(city_list)
|
@@ -3,403 +3,484 @@
|
|
3
3
|
name: 'Adana'
|
4
4
|
phone_code: 322
|
5
5
|
metropolitan_municipality_since: 1986
|
6
|
+
region: 'Akdeniz'
|
6
7
|
-
|
7
8
|
plate_number: 2
|
8
9
|
name: 'Adıyaman'
|
9
10
|
phone_code: 416
|
10
11
|
metropolitan_municipality_since: null
|
12
|
+
region: 'Güneydoğu Anadolu'
|
11
13
|
-
|
12
14
|
plate_number: 3
|
13
15
|
name: 'Afyon'
|
14
16
|
phone_code: 272
|
15
17
|
metropolitan_municipality_since: null
|
18
|
+
region: 'Ege'
|
16
19
|
-
|
17
20
|
plate_number: 4
|
18
21
|
name: 'Ağrı'
|
19
22
|
phone_code: 472
|
20
23
|
metropolitan_municipality_since: null
|
24
|
+
region: 'Doğu Anadolu'
|
21
25
|
-
|
22
26
|
plate_number: 5
|
23
27
|
name: 'Amasya'
|
24
28
|
phone_code: 358
|
25
29
|
metropolitan_municipality_since: null
|
30
|
+
region: 'Karadeniz'
|
26
31
|
-
|
27
32
|
plate_number: 6
|
28
33
|
name: 'Ankara'
|
29
34
|
phone_code: 312
|
30
35
|
metropolitan_municipality_since: 1984
|
36
|
+
region: 'İç Anadolu'
|
31
37
|
-
|
32
38
|
plate_number: 7
|
33
39
|
name: 'Antalya'
|
34
40
|
phone_code: 242
|
35
41
|
metropolitan_municipality_since: 1993
|
42
|
+
region: 'Akdeniz'
|
36
43
|
-
|
37
44
|
plate_number: 8
|
38
45
|
name: 'Artvin'
|
39
46
|
phone_code: 466
|
40
47
|
metropolitan_municipality_since: null
|
48
|
+
region: 'Karadeniz'
|
41
49
|
-
|
42
50
|
plate_number: 9
|
43
51
|
name: 'Aydın'
|
44
52
|
phone_code: 256
|
45
53
|
metropolitan_municipality_since: 2012
|
54
|
+
region: 'Ege'
|
46
55
|
-
|
47
56
|
plate_number: 10
|
48
57
|
name: 'Balıkesir'
|
49
58
|
phone_code: 266
|
50
59
|
metropolitan_municipality_since: 2012
|
60
|
+
region: 'Marmara'
|
51
61
|
-
|
52
62
|
plate_number: 11
|
53
63
|
name: 'Bilecik'
|
54
64
|
phone_code: 228
|
55
65
|
metropolitan_municipality_since: null
|
66
|
+
region: 'Marmara'
|
56
67
|
-
|
57
68
|
plate_number: 12
|
58
69
|
name: 'Bingöl'
|
59
70
|
phone_code: 426
|
60
71
|
metropolitan_municipality_since: null
|
72
|
+
region: 'Doğu Anadolu'
|
61
73
|
-
|
62
74
|
plate_number: 13
|
63
75
|
name: 'Bitlis'
|
64
76
|
phone_code: 434
|
65
77
|
metropolitan_municipality_since: null
|
78
|
+
region: 'Doğu Anadolu'
|
66
79
|
-
|
67
80
|
plate_number: 14
|
68
81
|
name: 'Bolu'
|
69
82
|
phone_code: 374
|
70
83
|
metropolitan_municipality_since: null
|
84
|
+
region: 'Karadeniz'
|
71
85
|
-
|
72
86
|
plate_number: 15
|
73
87
|
name: 'Burdur'
|
74
88
|
phone_code: 248
|
75
89
|
metropolitan_municipality_since: null
|
90
|
+
region: 'Akdeniz'
|
76
91
|
-
|
77
92
|
plate_number: 16
|
78
93
|
name: 'Bursa'
|
79
94
|
phone_code: 224
|
80
95
|
metropolitan_municipality_since: 1987
|
96
|
+
region: 'Marmara'
|
81
97
|
-
|
82
98
|
plate_number: 17
|
83
99
|
name: 'Çanakkale'
|
84
100
|
phone_code: 286
|
85
101
|
metropolitan_municipality_since: null
|
102
|
+
region: 'Marmara'
|
86
103
|
-
|
87
104
|
plate_number: 18
|
88
105
|
name: 'Çankırı'
|
89
106
|
phone_code: 376
|
90
107
|
metropolitan_municipality_since: null
|
108
|
+
region: 'İç Anadolu'
|
91
109
|
-
|
92
110
|
plate_number: 19
|
93
111
|
name: 'Çorum'
|
94
112
|
phone_code: 364
|
95
113
|
metropolitan_municipality_since: null
|
114
|
+
region: 'Karadeniz'
|
96
115
|
-
|
97
116
|
plate_number: 20
|
98
117
|
name: 'Denizli'
|
99
118
|
phone_code: 258
|
100
119
|
metropolitan_municipality_since: 2012
|
120
|
+
region: 'Ege'
|
101
121
|
-
|
102
122
|
plate_number: 21
|
103
123
|
name: 'Diyarbakır'
|
104
124
|
phone_code: 412
|
105
125
|
metropolitan_municipality_since: 1993
|
126
|
+
region: 'Güneydoğu Anadolu'
|
106
127
|
-
|
107
128
|
plate_number: 22
|
108
129
|
name: 'Edirne'
|
109
130
|
phone_code: 284
|
110
131
|
metropolitan_municipality_since: null
|
132
|
+
region: 'Marmara'
|
111
133
|
-
|
112
134
|
plate_number: 23
|
113
135
|
name: 'Elazığ'
|
114
136
|
phone_code: 424
|
115
137
|
metropolitan_municipality_since: null
|
138
|
+
region: 'Doğu Anadolu'
|
116
139
|
-
|
117
140
|
plate_number: 24
|
118
141
|
name: 'Erzincan'
|
119
142
|
phone_code: 446
|
120
143
|
metropolitan_municipality_since: null
|
144
|
+
region: 'Doğu Anadolu'
|
121
145
|
-
|
122
146
|
plate_number: 25
|
123
147
|
name: 'Erzurum'
|
124
148
|
phone_code: 442
|
125
149
|
metropolitan_municipality_since: 1993
|
150
|
+
region: 'Doğu Anadolu'
|
126
151
|
-
|
127
152
|
plate_number: 26
|
128
153
|
name: 'Eskişehir'
|
129
154
|
phone_code: 222
|
130
155
|
metropolitan_municipality_since: 1993
|
156
|
+
region: 'İç Anadolu'
|
131
157
|
-
|
132
158
|
plate_number: 27
|
133
159
|
name: 'Gaziantep'
|
134
160
|
phone_code: 342
|
135
161
|
metropolitan_municipality_since: 1987
|
162
|
+
region: 'Güneydoğu Anadolu'
|
136
163
|
-
|
137
164
|
plate_number: 28
|
138
165
|
name: 'Giresun'
|
139
166
|
phone_code: 454
|
140
167
|
metropolitan_municipality_since: null
|
168
|
+
region: 'Karadeniz'
|
141
169
|
-
|
142
170
|
plate_number: 29
|
143
171
|
name: 'Gümüşhane'
|
144
172
|
phone_code: 456
|
145
173
|
metropolitan_municipality_since: null
|
174
|
+
region: 'Karadeniz'
|
146
175
|
-
|
147
176
|
plate_number: 30
|
148
177
|
name: 'Hakkari'
|
149
178
|
phone_code: 438
|
150
179
|
metropolitan_municipality_since: null
|
180
|
+
region: 'Doğu Anadolu'
|
151
181
|
-
|
152
182
|
plate_number: 31
|
153
183
|
name: 'Hatay'
|
154
184
|
phone_code: 326
|
155
185
|
metropolitan_municipality_since: 2012
|
186
|
+
region: 'Akdeniz'
|
156
187
|
-
|
157
188
|
plate_number: 32
|
158
189
|
name: 'Isparta'
|
159
190
|
phone_code: 246
|
160
191
|
metropolitan_municipality_since: null
|
192
|
+
region: 'Akdeniz'
|
161
193
|
-
|
162
194
|
plate_number: 33
|
163
195
|
name: 'Mersin'
|
164
196
|
phone_code: 324
|
165
197
|
metropolitan_municipality_since: 1993
|
198
|
+
region: 'Akdeniz'
|
166
199
|
-
|
167
200
|
plate_number: 34
|
168
201
|
name: 'İstanbul'
|
169
202
|
phone_code: [212,216]
|
170
203
|
metropolitan_municipality_since: 1984
|
204
|
+
region: 'Marmara'
|
171
205
|
-
|
172
206
|
plate_number: 35
|
173
207
|
name: 'İzmir'
|
174
208
|
phone_code: 232
|
175
209
|
metropolitan_municipality_since: 1984
|
210
|
+
region: 'Ege'
|
176
211
|
-
|
177
212
|
plate_number: 36
|
178
213
|
name: 'Kars'
|
179
214
|
phone_code: 474
|
180
215
|
metropolitan_municipality_since: null
|
216
|
+
region: 'Doğu Anadolu'
|
181
217
|
-
|
182
218
|
plate_number: 37
|
183
219
|
name: 'Kastamonu'
|
184
220
|
phone_code: 366
|
185
221
|
metropolitan_municipality_since: null
|
222
|
+
region: 'Karadeniz'
|
186
223
|
-
|
187
224
|
plate_number: 38
|
188
225
|
name: 'Kayseri'
|
189
226
|
phone_code: 352
|
190
227
|
metropolitan_municipality_since: 1988
|
228
|
+
region: 'İç Anadolu'
|
191
229
|
-
|
192
230
|
plate_number: 39
|
193
231
|
name: 'Kırklareli'
|
194
232
|
phone_code: 288
|
195
233
|
metropolitan_municipality_since: null
|
234
|
+
region: 'Marmara'
|
196
235
|
-
|
197
236
|
plate_number: 40
|
198
237
|
name: 'Kırşehir'
|
199
238
|
phone_code: 386
|
200
239
|
metropolitan_municipality_since: null
|
240
|
+
region: 'İç Anadolu'
|
201
241
|
-
|
202
242
|
plate_number: 41
|
203
243
|
name: 'Kocaeli'
|
204
244
|
phone_code: 262
|
205
245
|
metropolitan_municipality_since: 1993
|
246
|
+
region: 'Marmara'
|
206
247
|
-
|
207
248
|
plate_number: 42
|
208
249
|
name: 'Konya'
|
209
250
|
phone_code: 332
|
210
251
|
metropolitan_municipality_since: 1987
|
252
|
+
region: 'İç Anadolu'
|
211
253
|
-
|
212
254
|
plate_number: 43
|
213
255
|
name: 'Kütahya'
|
214
256
|
phone_code: 274
|
215
257
|
metropolitan_municipality_since: null
|
258
|
+
region: 'Ege'
|
216
259
|
-
|
217
260
|
plate_number: 44
|
218
261
|
name: 'Malatya'
|
219
262
|
phone_code: 422
|
220
263
|
metropolitan_municipality_since: 2012
|
264
|
+
region: 'Doğu Anadolu'
|
221
265
|
-
|
222
266
|
plate_number: 45
|
223
267
|
name: 'Manisa'
|
224
268
|
phone_code: 236
|
225
269
|
metropolitan_municipality_since: 2012
|
270
|
+
region: 'Ege'
|
226
271
|
-
|
227
272
|
plate_number: 46
|
228
273
|
name: 'Kahramanmaraş'
|
229
274
|
phone_code: 344
|
230
275
|
metropolitan_municipality_since: 2012
|
276
|
+
region: 'Akdeniz'
|
231
277
|
-
|
232
278
|
plate_number: 47
|
233
279
|
name: 'Mardin'
|
234
280
|
phone_code: 482
|
235
281
|
metropolitan_municipality_since: 2012
|
282
|
+
region: 'Güneydoğu Anadolu'
|
236
283
|
-
|
237
284
|
plate_number: 48
|
238
285
|
name: 'Muğla'
|
239
286
|
phone_code: 252
|
240
287
|
metropolitan_municipality_since: 2012
|
288
|
+
region: 'Ege'
|
241
289
|
-
|
242
290
|
plate_number: 49
|
243
291
|
name: 'Muş'
|
244
292
|
phone_code: 436
|
245
293
|
metropolitan_municipality_since: null
|
294
|
+
region: 'Doğu Anadolu'
|
246
295
|
-
|
247
296
|
plate_number: 50
|
248
297
|
name: 'Nevşehir'
|
249
298
|
phone_code: 384
|
250
299
|
metropolitan_municipality_since: null
|
300
|
+
region: 'İç Anadolu'
|
251
301
|
-
|
252
302
|
plate_number: 51
|
253
303
|
name: 'Niğde'
|
254
304
|
phone_code: 388
|
255
305
|
metropolitan_municipality_since: null
|
306
|
+
region: 'İç Anadolu'
|
256
307
|
-
|
257
308
|
plate_number: 52
|
258
309
|
name: 'Ordu'
|
259
310
|
phone_code: 452
|
260
311
|
metropolitan_municipality_since: 2012
|
312
|
+
region: 'Karadeniz'
|
261
313
|
-
|
262
314
|
plate_number: 53
|
263
315
|
name: 'Rize'
|
264
316
|
phone_code: 464
|
265
317
|
metropolitan_municipality_since: null
|
318
|
+
region: 'Karadeniz'
|
266
319
|
-
|
267
320
|
plate_number: 54
|
268
321
|
name: 'Sakarya'
|
269
322
|
phone_code: 264
|
270
323
|
metropolitan_municipality_since: 2000
|
324
|
+
region: 'Marmara'
|
271
325
|
-
|
272
326
|
plate_number: 55
|
273
327
|
name: 'Samsun'
|
274
328
|
phone_code: 362
|
275
329
|
metropolitan_municipality_since: 1993
|
330
|
+
region: 'Karadeniz'
|
276
331
|
-
|
277
332
|
plate_number: 56
|
278
333
|
name: 'Siirt'
|
279
334
|
phone_code: 484
|
280
335
|
metropolitan_municipality_since: null
|
336
|
+
region: 'Güneydoğu Anadolu'
|
281
337
|
-
|
282
338
|
plate_number: 57
|
283
339
|
name: 'Sinop'
|
284
340
|
phone_code: 368
|
285
341
|
metropolitan_municipality_since: null
|
342
|
+
region: 'Karadeniz'
|
286
343
|
-
|
287
344
|
plate_number: 58
|
288
345
|
name: 'Sivas'
|
289
346
|
phone_code: 346
|
290
347
|
metropolitan_municipality_since: null
|
348
|
+
region: 'İç Anadolu'
|
291
349
|
-
|
292
350
|
plate_number: 59
|
293
351
|
name: 'Tekirdağ'
|
294
352
|
phone_code: 282
|
295
353
|
metropolitan_municipality_since: 2012
|
354
|
+
region: 'Marmara'
|
296
355
|
-
|
297
356
|
plate_number: 60
|
298
357
|
name: 'Tokat'
|
299
358
|
phone_code: 356
|
300
359
|
metropolitan_municipality_since: null
|
360
|
+
region: 'Karadeniz'
|
301
361
|
-
|
302
362
|
plate_number: 61
|
303
363
|
name: 'Trabzon'
|
304
364
|
phone_code: 462
|
305
365
|
metropolitan_municipality_since: 2012
|
366
|
+
region: 'Karadeniz'
|
306
367
|
-
|
307
368
|
plate_number: 62
|
308
369
|
name: 'Tunceli'
|
309
370
|
phone_code: 428
|
310
371
|
metropolitan_municipality_since: null
|
372
|
+
region: 'Doğu Anadolu'
|
311
373
|
-
|
312
374
|
plate_number: 63
|
313
375
|
name: 'Şanlıurfa'
|
314
376
|
phone_code: 414
|
315
377
|
metropolitan_municipality_since: 2012
|
378
|
+
region: 'Güneydoğu Anadolu'
|
316
379
|
-
|
317
380
|
plate_number: 64
|
318
381
|
name: 'Uşak'
|
319
382
|
phone_code: 276
|
320
383
|
metropolitan_municipality_since: null
|
384
|
+
region: 'Ege'
|
321
385
|
-
|
322
386
|
plate_number: 65
|
323
387
|
name: 'Van'
|
324
388
|
phone_code: 432
|
325
389
|
metropolitan_municipality_since: 2012
|
390
|
+
region: 'Doğu Anadolu'
|
326
391
|
-
|
327
392
|
plate_number: 66
|
328
393
|
name: 'Yozgat'
|
329
394
|
phone_code: 354
|
330
395
|
metropolitan_municipality_since: null
|
396
|
+
region: 'İç Anadolu'
|
331
397
|
-
|
332
398
|
plate_number: 67
|
333
399
|
name: 'Zonguldak'
|
334
400
|
phone_code: 372
|
335
401
|
metropolitan_municipality_since: null
|
402
|
+
region: 'Karadeniz'
|
336
403
|
-
|
337
404
|
plate_number: 68
|
338
405
|
name: 'Aksaray'
|
339
406
|
phone_code: 382
|
340
407
|
metropolitan_municipality_since: null
|
408
|
+
region: 'İç Anadolu'
|
341
409
|
-
|
342
410
|
plate_number: 69
|
343
411
|
name: 'Bayburt'
|
344
412
|
phone_code: 458
|
345
413
|
metropolitan_municipality_since: null
|
414
|
+
region: 'Karadeniz'
|
346
415
|
-
|
347
416
|
plate_number: 70
|
348
417
|
name: 'Karaman'
|
349
418
|
phone_code: 338
|
350
419
|
metropolitan_municipality_since: null
|
420
|
+
region: 'İç Anadolu'
|
351
421
|
-
|
352
422
|
plate_number: 71
|
353
423
|
name: 'Kırıkkale'
|
354
424
|
phone_code: 318
|
355
425
|
metropolitan_municipality_since: null
|
426
|
+
region: 'İç Anadolu'
|
356
427
|
-
|
357
428
|
plate_number: 72
|
358
429
|
name: 'Batman'
|
359
430
|
phone_code: 488
|
360
431
|
metropolitan_municipality_since: null
|
432
|
+
region: 'Güneydoğu Anadolu'
|
361
433
|
-
|
362
434
|
plate_number: 73
|
363
435
|
name: 'Şırnak'
|
364
436
|
phone_code: 486
|
365
437
|
metropolitan_municipality_since: null
|
438
|
+
region: 'Güneydoğu Anadolu'
|
366
439
|
-
|
367
440
|
plate_number: 74
|
368
441
|
name: 'Bartın'
|
369
442
|
phone_code: 378
|
370
443
|
metropolitan_municipality_since: null
|
444
|
+
region: 'Karadeniz'
|
371
445
|
-
|
372
446
|
plate_number: 75
|
373
447
|
name: 'Ardahan'
|
374
448
|
phone_code: 478
|
375
449
|
metropolitan_municipality_since: null
|
450
|
+
region: 'Doğu Anadolu'
|
376
451
|
-
|
377
452
|
plate_number: 76
|
378
453
|
name: 'Iğdır'
|
379
454
|
phone_code: 476
|
380
455
|
metropolitan_municipality_since: null
|
456
|
+
region: 'Doğu Anadolu'
|
381
457
|
-
|
382
458
|
plate_number: 77
|
383
459
|
name: 'Yalova'
|
384
460
|
phone_code: 226
|
385
461
|
metropolitan_municipality_since: null
|
462
|
+
region: 'Marmara'
|
386
463
|
-
|
387
464
|
plate_number: 78
|
388
465
|
name: 'Karabük'
|
389
466
|
phone_code: 370
|
390
467
|
metropolitan_municipality_since: null
|
468
|
+
region: 'Karadeniz'
|
391
469
|
-
|
392
470
|
plate_number: 79
|
393
471
|
name: 'Kilis'
|
394
472
|
phone_code: 348
|
395
473
|
metropolitan_municipality_since: null
|
474
|
+
region: 'Güneydoğu Anadolu'
|
396
475
|
-
|
397
476
|
plate_number: 80
|
398
477
|
name: 'Osmaniye'
|
399
478
|
phone_code: 328
|
400
479
|
metropolitan_municipality_since: null
|
480
|
+
region: 'Akdeniz'
|
401
481
|
-
|
402
482
|
plate_number: 81
|
403
483
|
name: 'Düzce'
|
404
484
|
phone_code: 380
|
405
|
-
metropolitan_municipality_since: null
|
485
|
+
metropolitan_municipality_since: null
|
486
|
+
region: 'Karadeniz'
|
data/lib/turkish_cities.rb
CHANGED
@@ -8,8 +8,16 @@ class TurkishCities
|
|
8
8
|
City.new.find_by_id(plate_number)
|
9
9
|
end
|
10
10
|
|
11
|
+
def self.find_name_by_phone_code(phone_code)
|
12
|
+
City.new.find_by_phone_code(phone_code)
|
13
|
+
end
|
14
|
+
|
11
15
|
def self.find_plate_number_by_name(city_name)
|
12
|
-
City.new.find_by_name(city_name)
|
16
|
+
City.new.find_by_name(city_name, 'plate_number')
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.find_phone_code_by_name(city_name)
|
20
|
+
City.new.find_by_name(city_name, 'phone_code')
|
13
21
|
end
|
14
22
|
|
15
23
|
def self.list_cities(options = {})
|
data/turkish_cities.gemspec
CHANGED
@@ -24,7 +24,7 @@ Gem::Specification.new do |s|
|
|
24
24
|
s.add_development_dependency 'bundler', '~> 2.1.4'
|
25
25
|
s.add_development_dependency 'coveralls', '~> 0.8.23'
|
26
26
|
s.add_development_dependency 'rspec', '~> 3.9.0'
|
27
|
-
s.add_development_dependency 'rubocop', '~> 0.
|
27
|
+
s.add_development_dependency 'rubocop', '~> 0.82.0'
|
28
28
|
|
29
29
|
if s.respond_to?(:metadata)
|
30
30
|
s.metadata['changelog_uri'] = 'https://github.com/sarslanoglu/turkish_cities/blob/master/CHANGELOG.md'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: turkish_cities
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Semih Arslanoglu
|
@@ -78,14 +78,14 @@ dependencies:
|
|
78
78
|
requirements:
|
79
79
|
- - "~>"
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
version: 0.
|
81
|
+
version: 0.82.0
|
82
82
|
type: :development
|
83
83
|
prerelease: false
|
84
84
|
version_requirements: !ruby/object:Gem::Requirement
|
85
85
|
requirements:
|
86
86
|
- - "~>"
|
87
87
|
- !ruby/object:Gem::Version
|
88
|
-
version: 0.
|
88
|
+
version: 0.82.0
|
89
89
|
description: Simple ruby gem for listing and finding Turkish cities via name, plate
|
90
90
|
number or size
|
91
91
|
email: arslanoglusemih93@gmail.com
|
@@ -100,6 +100,7 @@ files:
|
|
100
100
|
- ".travis.yml"
|
101
101
|
- CHANGELOG.md
|
102
102
|
- CODE_OF_CONDUCT.md
|
103
|
+
- CONTRIBUTING.md
|
103
104
|
- Gemfile
|
104
105
|
- Gemfile.lock
|
105
106
|
- LICENSE.txt
|