turkish_cities 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.circleci/config.yml +34 -0
- data/.github/workflows/ruby.yml +39 -0
- data/.rubocop.yml +1 -0
- data/CHANGELOG.md +6 -0
- data/Gemfile.lock +33 -41
- data/README.md +133 -34
- data/Rakefile +11 -0
- data/lib/turkish_cities/version.rb +1 -1
- data/lib/turkish_cities.rb +2 -1
- data/turkish_cities.gemspec +4 -3
- metadata +27 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e226b8c384ed7a4da21f58275b42aed79fdeaf86eb2d7bd2010ddfbcdc68235c
|
4
|
+
data.tar.gz: ceaa74bb9cb4f1b8b8644d078b029d1acfb74968fad3b239caeac326e03a6848
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 65baf5e107ef85c6f216702e4a5411f7675b5d091770ba9b4aa0c7836297edcc8684b119f3d6e16cd65792a4b7b85364c0384ff69faa6c6358dd8dd2261ed4b5
|
7
|
+
data.tar.gz: bbb68a76d9acf156000e12ea300bc038b833bd9f76ff2f8fa9870f3373bb08bfb94ce2f97f2c1488fe28b87aca419871967b093359a237779fbcd9a3670c8045
|
@@ -0,0 +1,34 @@
|
|
1
|
+
# Use the latest 2.1 version of CircleCI pipeline process engine.
|
2
|
+
# See: https://circleci.com/docs/2.0/configuration-reference
|
3
|
+
version: 2.1
|
4
|
+
|
5
|
+
# Define a job to be invoked later in a workflow.
|
6
|
+
# See: https://circleci.com/docs/2.0/configuration-reference/#jobs
|
7
|
+
orbs:
|
8
|
+
ruby: circleci/ruby@1.0.4
|
9
|
+
|
10
|
+
jobs:
|
11
|
+
test:
|
12
|
+
# Specify the execution environment. You can specify an image from Dockerhub or use one of our Convenience Images from CircleCI's Developer Hub.
|
13
|
+
# See: https://circleci.com/docs/2.0/configuration-reference/#docker-machine-macos-windows-executor
|
14
|
+
docker:
|
15
|
+
- image: cimg/ruby:2.7
|
16
|
+
# Add steps to the job
|
17
|
+
# See: https://circleci.com/docs/2.0/configuration-reference/#steps
|
18
|
+
steps:
|
19
|
+
- checkout
|
20
|
+
- ruby/install-deps
|
21
|
+
- run:
|
22
|
+
name: Run rubocop
|
23
|
+
command: bundle exec rubocop
|
24
|
+
- run:
|
25
|
+
name: Run tests
|
26
|
+
command: bundle exec rake
|
27
|
+
|
28
|
+
# Invoke jobs via workflows
|
29
|
+
# See: https://circleci.com/docs/2.0/configuration-reference/#workflows
|
30
|
+
workflows:
|
31
|
+
version: 2
|
32
|
+
deploy:
|
33
|
+
jobs:
|
34
|
+
- test
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# This workflow uses actions that are not certified by GitHub.
|
2
|
+
# They are provided by a third-party and are governed by
|
3
|
+
# separate terms of service, privacy policy, and support
|
4
|
+
# documentation.
|
5
|
+
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
|
6
|
+
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
7
|
+
|
8
|
+
name: Ruby
|
9
|
+
|
10
|
+
on:
|
11
|
+
push:
|
12
|
+
branches: [ master ]
|
13
|
+
pull_request:
|
14
|
+
branches: [ master ]
|
15
|
+
|
16
|
+
permissions:
|
17
|
+
contents: read
|
18
|
+
|
19
|
+
jobs:
|
20
|
+
test:
|
21
|
+
|
22
|
+
runs-on: ubuntu-latest
|
23
|
+
strategy:
|
24
|
+
matrix:
|
25
|
+
ruby-version: ['2.6', '2.7']
|
26
|
+
|
27
|
+
steps:
|
28
|
+
- uses: actions/checkout@v3
|
29
|
+
- name: Set up Ruby
|
30
|
+
uses: ruby/setup-ruby@v1
|
31
|
+
with:
|
32
|
+
ruby-version: ${{ matrix.ruby-version }}
|
33
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
34
|
+
- name: RuboCop
|
35
|
+
run: bundle exec rubocop
|
36
|
+
- name: Run tests
|
37
|
+
run: bundle exec rspec
|
38
|
+
- uses: actions/checkout@master
|
39
|
+
- uses: codecov/codecov-action@v2
|
data/.rubocop.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,67 +1,58 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
turkish_cities (0.6.
|
4
|
+
turkish_cities (0.6.1)
|
5
5
|
i18n (>= 0.6.4, <= 2)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
10
|
ast (2.4.2)
|
11
|
+
codecov (0.6.0)
|
12
|
+
simplecov (>= 0.15, < 0.22)
|
11
13
|
concurrent-ruby (1.1.9)
|
12
|
-
|
13
|
-
|
14
|
-
simplecov (~> 0.16.1)
|
15
|
-
term-ansicolor (~> 1.3)
|
16
|
-
thor (>= 0.19.4, < 2.0)
|
17
|
-
tins (~> 1.6)
|
18
|
-
diff-lcs (1.4.4)
|
19
|
-
docile (1.3.2)
|
14
|
+
diff-lcs (1.5.0)
|
15
|
+
docile (1.4.0)
|
20
16
|
i18n (1.10.0)
|
21
17
|
concurrent-ruby (~> 1.0)
|
22
|
-
|
23
|
-
|
24
|
-
parser (3.1.0.0)
|
18
|
+
parallel (1.22.1)
|
19
|
+
parser (3.1.2.0)
|
25
20
|
ast (~> 2.4.1)
|
26
21
|
rainbow (3.1.1)
|
27
|
-
|
22
|
+
rake (13.0.6)
|
23
|
+
regexp_parser (2.3.0)
|
28
24
|
rexml (3.2.5)
|
29
|
-
rspec (3.
|
30
|
-
rspec-core (~> 3.
|
31
|
-
rspec-expectations (~> 3.
|
32
|
-
rspec-mocks (~> 3.
|
33
|
-
rspec-core (3.
|
34
|
-
rspec-support (~> 3.
|
35
|
-
rspec-expectations (3.
|
25
|
+
rspec (3.11.0)
|
26
|
+
rspec-core (~> 3.11.0)
|
27
|
+
rspec-expectations (~> 3.11.0)
|
28
|
+
rspec-mocks (~> 3.11.0)
|
29
|
+
rspec-core (3.11.0)
|
30
|
+
rspec-support (~> 3.11.0)
|
31
|
+
rspec-expectations (3.11.0)
|
36
32
|
diff-lcs (>= 1.2.0, < 2.0)
|
37
|
-
rspec-support (~> 3.
|
38
|
-
rspec-mocks (3.
|
33
|
+
rspec-support (~> 3.11.0)
|
34
|
+
rspec-mocks (3.11.0)
|
39
35
|
diff-lcs (>= 1.2.0, < 2.0)
|
40
|
-
rspec-support (~> 3.
|
41
|
-
rspec-support (3.
|
42
|
-
rubocop (1.
|
36
|
+
rspec-support (~> 3.11.0)
|
37
|
+
rspec-support (3.11.0)
|
38
|
+
rubocop (1.27.0)
|
43
39
|
parallel (~> 1.10)
|
44
40
|
parser (>= 3.1.0.0)
|
45
41
|
rainbow (>= 2.2.2, < 4.0)
|
46
42
|
regexp_parser (>= 1.8, < 3.0)
|
47
43
|
rexml
|
48
|
-
rubocop-ast (>= 1.
|
44
|
+
rubocop-ast (>= 1.16.0, < 2.0)
|
49
45
|
ruby-progressbar (~> 1.7)
|
50
46
|
unicode-display_width (>= 1.4.0, < 3.0)
|
51
|
-
rubocop-ast (1.
|
52
|
-
parser (>= 3.
|
47
|
+
rubocop-ast (1.17.0)
|
48
|
+
parser (>= 3.1.1.0)
|
53
49
|
ruby-progressbar (1.11.0)
|
54
|
-
simplecov (0.
|
50
|
+
simplecov (0.21.2)
|
55
51
|
docile (~> 1.1)
|
56
|
-
|
57
|
-
|
58
|
-
simplecov-html (0.
|
59
|
-
|
60
|
-
term-ansicolor (1.7.1)
|
61
|
-
tins (~> 1.0)
|
62
|
-
thor (1.0.1)
|
63
|
-
tins (1.25.0)
|
64
|
-
sync
|
52
|
+
simplecov-html (~> 0.11)
|
53
|
+
simplecov_json_formatter (~> 0.1)
|
54
|
+
simplecov-html (0.12.3)
|
55
|
+
simplecov_json_formatter (0.1.4)
|
65
56
|
unicode-display_width (2.1.0)
|
66
57
|
|
67
58
|
PLATFORMS
|
@@ -69,9 +60,10 @@ PLATFORMS
|
|
69
60
|
|
70
61
|
DEPENDENCIES
|
71
62
|
bundler (~> 2.2.16)
|
72
|
-
|
73
|
-
|
74
|
-
|
63
|
+
codecov (~> 0.6.0)
|
64
|
+
rake (~> 13.0.6)
|
65
|
+
rspec (~> 3.11.0)
|
66
|
+
rubocop (~> 1.27.0)
|
75
67
|
turkish_cities!
|
76
68
|
|
77
69
|
BUNDLED WITH
|
data/README.md
CHANGED
@@ -3,10 +3,10 @@
|
|
3
3
|
<p align="center">
|
4
4
|
<a href="https://rubygems.org/gems/turkish_cities">
|
5
5
|
<img src="https://badge.fury.io/rb/turkish_cities.svg" alt="GemVersion"/></a>
|
6
|
-
<a href="https://
|
7
|
-
<img src="https://
|
8
|
-
<a href="https://
|
9
|
-
<img src="https://
|
6
|
+
<a href="https://app.circleci.com/pipelines/github/sarslanoglu/turkish_cities">
|
7
|
+
<img src="https://circleci.com/gh/sarslanoglu/turkish_cities.svg?style=shield" alt="BuildStatus"/></a>
|
8
|
+
<a href="https://codecov.io/gh/sarslanoglu/turkish_cities">
|
9
|
+
<img src="https://codecov.io/gh/sarslanoglu/turkish_cities/branch/master/graph/badge.svg?token=1SU7ZFI8ZJ"/></a>
|
10
10
|
<a href="https://rubygems.org/gems/turkish_cities">
|
11
11
|
<img src="https://img.shields.io/gem/dt/turkish_cities.svg" alt="DownloadCount"/></a>
|
12
12
|
<a href="https://codeclimate.com/github/sarslanoglu/turkish_cities/maintainability">
|
@@ -20,36 +20,62 @@
|
|
20
20
|
**Turkish Cities** is a Ruby gem which makes listing and finding Turkish cities easy. Search can be via name, post code, plate number, district name etc. Also calculate your travel distance and travel time between cities via distance methods.
|
21
21
|
https://rubygems.org/gems/turkish_cities
|
22
22
|
|
23
|
+
|
23
24
|
## Table of Contents
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
25
|
+
<details>
|
26
|
+
<summary>Table of Contents</summary>
|
27
|
+
<ul>
|
28
|
+
<li><a href="#installation">Installation</a></li>
|
29
|
+
<li><a href="#localization">Localization</a></li>
|
30
|
+
<li>
|
31
|
+
<a href="#documentation">Documentation</a>
|
32
|
+
<ul>
|
33
|
+
<li><a href="#finding-city-name-by-plate-number">Finding city name by plate number</a></li>
|
34
|
+
<li><a href="#finding-city-name-by-phone-code">Finding city name by phone code</a></li>
|
35
|
+
<li><a href="#finding-plate-number-by-city-name">Finding plate number by city name</a></li>
|
36
|
+
<li><a href="#finding-phone-code-by-city-name">Finding phone code by city name</a></li>
|
37
|
+
<li>
|
38
|
+
<a href="#listing-all-cities">Listing all cities</a>
|
39
|
+
<ul>
|
40
|
+
<li><a href="#listing-all-cities-with-only-name">Listing all cities with only name</a></li>
|
41
|
+
<li><a href="#listing-all-cities-with-other-parameters">Listing all cities with other parameters</a></li>
|
42
|
+
</ul>
|
43
|
+
</li>
|
44
|
+
<li><a href="#listing-all-districts-of-given-city">Listing all districts of given city</a></li>
|
45
|
+
<li><a href="#listing-all-subdistricts-of-given-city-and-district">Listing all subdistricts of given city and district</a></li>
|
46
|
+
<li>
|
47
|
+
<a href="#listing-all-neighborhoods-of-given-city-and-district">Listing all neighborhoods of given city and district</a>
|
48
|
+
<ul>
|
49
|
+
<li><a href="#with-subdistrict-info">With subdistrict info</a></li>
|
50
|
+
<li><a href="#without-subdistrict-info">Without subdistrict info</a></li>
|
51
|
+
</ul>
|
52
|
+
</li>
|
53
|
+
<li><a href="#finding-city-district-and-subdistrict-name-by-postcode">Finding city, district and subdistrict name by postcode</a></li>
|
54
|
+
<li>
|
55
|
+
<a href="#finding-city-name-with-population-data">Finding city name with population data</a>
|
56
|
+
<ul>
|
57
|
+
<li><a href="#exact-search">Exact search</a></li>
|
58
|
+
<li><a href="#below-given">Below given</a></li>
|
59
|
+
<li><a href="#above-given">Above given</a></li>
|
60
|
+
<li><a href="#between-search">Between search</a></li>
|
61
|
+
</ul>
|
62
|
+
</li>
|
63
|
+
<li>
|
64
|
+
<a href="#finding-travel-distance-and-time-estimation-between-two-cities">Finding travel distance and time estimation between two cities</a>
|
65
|
+
<ul>
|
66
|
+
<li><a href="#by-land">By land</a></li>
|
67
|
+
<li><a href="#by-air">By air</a></li>
|
68
|
+
</ul>
|
69
|
+
</li>
|
70
|
+
</ul>
|
71
|
+
</li>
|
72
|
+
<li><a href="#data-sources">Data sources</a></li>
|
73
|
+
<li><a href="#compatibility">Compatibility</a></li>
|
74
|
+
<li><a href="#contributing">Contributing</a></li>
|
75
|
+
<li><a href="#changelog">Changelog</a></li>
|
76
|
+
<li><a href="#copyright">Copyright</a></li>
|
77
|
+
</ul>
|
78
|
+
</details>
|
53
79
|
|
54
80
|
## Installation
|
55
81
|
|
@@ -101,6 +127,9 @@ require 'turkish_cities'
|
|
101
127
|
|
102
128
|
There are 81 cities in Turkey. By calling a plate number between 1-81 will give city_name.
|
103
129
|
|
130
|
+
<details>
|
131
|
+
<summary>Expand</summary>
|
132
|
+
|
104
133
|
```rb
|
105
134
|
TurkishCities.find_name_by_plate_number(26) # => "Eskişehir"
|
106
135
|
TurkishCities.find_name_by_plate_number(7) # => "Antalya"
|
@@ -109,11 +138,15 @@ TurkishCities.find_name_by_plate_number(43.0) # => "Kütahya"
|
|
109
138
|
TurkishCities.find_name_by_plate_number('78') # => "Karabük"
|
110
139
|
TurkishCities.find_name_by_plate_number(100) # => 'Given value [100] is outside bounds of 1 to 81.'
|
111
140
|
```
|
141
|
+
</details>
|
112
142
|
|
113
143
|
### Finding city name by phone code
|
114
144
|
|
115
145
|
There are 82 phone codes for each city in Turkey (Istanbul is an exception with different phone codes for Anatolian side and European side). By calling a phone code between 212-488 will give city_name. All phone codes ending with even numbers. So sending an odd number will give an error without searching.
|
116
146
|
|
147
|
+
<details>
|
148
|
+
<summary>Expand</summary>
|
149
|
+
|
117
150
|
```rb
|
118
151
|
TurkishCities.find_name_by_phone_code(312) # => "Ankara"
|
119
152
|
TurkishCities.find_name_by_phone_code(242) # => "Antalya"
|
@@ -125,11 +158,15 @@ TurkishCities.find_name_by_phone_code(360) # => 'Couldn't find city name with
|
|
125
158
|
TurkishCities.find_name_by_phone_code(0) # => 'Given value [0] is outside bounds of 212 to 488.'
|
126
159
|
TurkishCities.find_name_by_phone_code(213) # => 'Given value [213] must be an even number.'
|
127
160
|
```
|
161
|
+
</details>
|
128
162
|
|
129
163
|
### Finding plate number by city name
|
130
164
|
|
131
165
|
City name can be given case and turkish character insensitive.
|
132
166
|
|
167
|
+
<details>
|
168
|
+
<summary>Expand</summary>
|
169
|
+
|
133
170
|
```rb
|
134
171
|
TurkishCities.find_plate_number_by_name('Ankara') # => 6
|
135
172
|
TurkishCities.find_plate_number_by_name('Eskişehir') # => 26
|
@@ -138,11 +175,15 @@ TurkishCities.find_plate_number_by_name('Istanbul') # => 34
|
|
138
175
|
TurkishCities.find_plate_number_by_name('kirsehir') # => 40
|
139
176
|
TurkishCities.find_plate_number_by_name('falansehir') # => "Couldn't find city name with 'falansehir'"
|
140
177
|
```
|
178
|
+
</details>
|
141
179
|
|
142
180
|
### Finding phone code by city name
|
143
181
|
|
144
182
|
City name can be given case and turkish character insensitive.
|
145
183
|
|
184
|
+
<details>
|
185
|
+
<summary>Expand</summary>
|
186
|
+
|
146
187
|
```rb
|
147
188
|
TurkishCities.find_phone_code_by_name('Ankara') # => 312
|
148
189
|
TurkishCities.find_phone_code_by_name('Eskişehir') # => 222
|
@@ -151,19 +192,27 @@ TurkishCities.find_phone_code_by_name('Istanbul') # => [212, 216]
|
|
151
192
|
TurkishCities.find_phone_code_by_name('kirsehir') # => 386
|
152
193
|
TurkishCities.find_phone_code_by_name('filansehir') # => "Couldn't find city name with 'filansehir'"
|
153
194
|
```
|
195
|
+
</details>
|
154
196
|
|
155
197
|
### Listing all cities
|
156
198
|
|
157
199
|
By default cities will be listed by their plate number ascending.
|
158
200
|
|
201
|
+
<details>
|
202
|
+
<summary>Expand</summary>
|
203
|
+
|
159
204
|
```rb
|
160
205
|
TurkishCities.list_cities # => ["Adana", "Adıyaman" ... "Kilis", "Osmaniye", "Düzce"]
|
161
206
|
```
|
207
|
+
</details>
|
162
208
|
|
163
209
|
### Listing all cities with only name
|
164
210
|
|
165
211
|
While listing cities three additional parameters can be sent ```alphabetically_sorted```, ```metropolitan_municipality``` and ```region```. All parameters can be sent separately and together.
|
166
212
|
|
213
|
+
<details>
|
214
|
+
<summary>Expand</summary>
|
215
|
+
|
167
216
|
```rb
|
168
217
|
TurkishCities.list_cities({ alphabetically_sorted: true })
|
169
218
|
# => ["Adana", "Adıyaman" ... "Yalova", "Yozgat", "Zonguldak"]
|
@@ -178,11 +227,15 @@ TurkishCities.list_cities({ metropolitan_municipality: true, region: 'Karadeniz'
|
|
178
227
|
TurkishCities.list_cities({ alphabetically_sorted: true, metropolitan_municipality: true })
|
179
228
|
# => ["Adana", "Ankara" ... "Tekirdağ", "Trabzon", "Van"]
|
180
229
|
```
|
230
|
+
</details>
|
181
231
|
|
182
232
|
### Listing all cities with other parameters
|
183
233
|
|
184
234
|
While listing cities ```with``` parameter can be used for listing cities with other attributes. These parameters are ```alphabetically_sorted```, ```metropolitan_municipality``` and ```region```. All parameters can be sent separately and together.
|
185
235
|
|
236
|
+
<details>
|
237
|
+
<summary>Expand</summary>
|
238
|
+
|
186
239
|
```rb
|
187
240
|
TurkishCities.list_cities({ alphabetically_sorted: true, with: { phone_code: true } })
|
188
241
|
# => [{:name=>"Adana", :phone_code=>322}, {:name=>"Adıyaman", :phone_code=>416}, {:name=>"Afyon", :phone_code=>272} .
|
@@ -196,11 +249,15 @@ TurkishCities.list_cities({ metropolitan_municipality: true, region: 'Karadeniz'
|
|
196
249
|
# :metropolitan_municipality_since=>1993, :region=>"Karadeniz"}, {:name=>"Trabzon", :plate_number=>61,
|
197
250
|
# :phone_code=>462, :metropolitan_municipality_since=>2012, :region=>"Karadeniz"}]
|
198
251
|
```
|
252
|
+
</details>
|
199
253
|
|
200
254
|
### Listing all districts of given city
|
201
255
|
|
202
256
|
City name can be given case and turkish character insensitive. Listing of districts are alphabetically sorted.
|
203
257
|
|
258
|
+
<details>
|
259
|
+
<summary>Expand</summary>
|
260
|
+
|
204
261
|
```rb
|
205
262
|
TurkishCities.list_districts('Ankara')
|
206
263
|
# => ["Akyurt", "Altındağ" ... "Sincan", "Şereflikoçhisar", "Yenimahalle"]
|
@@ -215,11 +272,15 @@ TurkishCities.list_districts('Istanbul').length
|
|
215
272
|
TurkishCities.list_districts('filansehir')
|
216
273
|
# => "Couldn't find city name with 'filansehir'"
|
217
274
|
```
|
275
|
+
</details>
|
218
276
|
|
219
277
|
### Listing all subdistricts of given city and district
|
220
278
|
|
221
279
|
City name can be given case and turkish character insensitive. District name should be case and turkish character sensitive.(Correct district names can be obtained by ```list_districts``` method.) Listing of subdistricts are alphabetically sorted.
|
222
280
|
|
281
|
+
<details>
|
282
|
+
<summary>Expand</summary>
|
283
|
+
|
223
284
|
```rb
|
224
285
|
TurkishCities.list_subdistricts('Adana', 'Seyhan')
|
225
286
|
# => ["Akkapı", "Denizli" ... "Yeşiloba", "Yeşilyurt", "Ziyapaşa"]
|
@@ -233,12 +294,17 @@ TurkishCities.list_subdistricts('İstanbul', 'Kadılarköyü')
|
|
233
294
|
# => "Couldn't find district name with 'Kadılarköyü' of 'İstanbul'"
|
234
295
|
```
|
235
296
|
|
297
|
+
</details>
|
298
|
+
|
236
299
|
### Listing all neighborhoods of given city and district
|
237
300
|
|
238
301
|
### With subdistrict info
|
239
302
|
|
240
303
|
City name can be given case and turkish character insensitive. District name and subdistrict name should be case and turkish character sensitive.(Correct district names can be obtained by the ```list_districts``` method. Correct subdistrict names can be obtained by ```list_subdistricts``` method.) Listings of neighborhoods are alphabetically sorted.
|
241
304
|
|
305
|
+
<details>
|
306
|
+
<summary>Expand</summary>
|
307
|
+
|
242
308
|
```rb
|
243
309
|
TurkishCities.list_neighborhoods('Adana', 'Seyhan', 'Emek')
|
244
310
|
# => ["Emek Mah", "Ova Mah", "Şakirpaşa Mah", "Uçak Mah"]
|
@@ -251,6 +317,7 @@ TurkishCities.list_neighborhoods('Adana', 'Beşiktaş', 'Emek')
|
|
251
317
|
TurkishCities.list_neighborhoods('Eskişehir', 'Odunpazarı', 'Büyükkkkkdere')
|
252
318
|
# => "Couldn't find subdistrict with 'Büyükkkkkdere' of 'Odunpazarı'/'Eskişehir'"
|
253
319
|
```
|
320
|
+
</details>
|
254
321
|
|
255
322
|
### Without subdistrict info
|
256
323
|
|
@@ -258,6 +325,9 @@ Also ```list_neighborhoods``` can work without subdistrict information. This tim
|
|
258
325
|
|
259
326
|
City name can be given case and turkish character insensitive. District name should be case and turkish character sensitive.(Correct district names can be obtained by the ```list_districts``` method.) Listings of neighborhoods are alphabetically sorted.
|
260
327
|
|
328
|
+
<details>
|
329
|
+
<summary>Expand</summary>
|
330
|
+
|
261
331
|
```rb
|
262
332
|
TurkishCities.list_neighborhoods('Adana', 'Seyhan')
|
263
333
|
# => ["2000 Evler Mah", "Ahmet Remzi Yüreğir Mah", "Akkapı Mah" ... "Zeytinli Mah", "Ziyapaşa Mah"]
|
@@ -268,11 +338,15 @@ TurkishCities.list_neighborhoods('Istanbul', 'Beşiktaş')
|
|
268
338
|
TurkishCities.list_neighborhoods('İstanbul', 'filanmevki')
|
269
339
|
# => "Couldn't find district name with 'filanmevki' of 'İstanbul'"
|
270
340
|
```
|
341
|
+
</details>
|
271
342
|
|
272
343
|
### Finding city, district and subdistrict name by postcode
|
273
344
|
|
274
345
|
In Turkey postcodes are uniq for subdistricts. Basically when a postcode is search through ```find_by_postcode``` it will give city, district and subdistrict information of postcode if valid and found
|
275
346
|
|
347
|
+
<details>
|
348
|
+
<summary>Expand</summary>
|
349
|
+
|
276
350
|
```rb
|
277
351
|
TurkishCities.find_by_postcode(34380) # => ["İstanbul", "Şişli", "Cumhuriyet"]
|
278
352
|
TurkishCities.find_by_postcode(34433) # => ["İstanbul", "Beyoğlu", "Cihangir"]
|
@@ -280,6 +354,7 @@ TurkishCities.find_by_postcode('26040') # => ["Eskişehir", "Odunpazarı", "Bü
|
|
280
354
|
TurkishCities.find_by_postcode(34382) # => "Couldn't find any subdistrict with postcode '34382'"
|
281
355
|
TurkishCities.find_by_postcode('100000') # => Given value [100000] is outside bounds of 1010 to 81952.
|
282
356
|
```
|
357
|
+
</details>
|
283
358
|
|
284
359
|
### Finding city name with population data
|
285
360
|
|
@@ -287,6 +362,9 @@ TurkishCities.find_by_postcode('100000') # => Given value [100000] is outside bo
|
|
287
362
|
|
288
363
|
Search city name with exact population
|
289
364
|
|
365
|
+
<details>
|
366
|
+
<summary>Expand</summary>
|
367
|
+
|
290
368
|
```rb
|
291
369
|
TurkishCities.find_by_population('exact', 15840900)
|
292
370
|
# => ["İstanbul"]
|
@@ -297,11 +375,15 @@ TurkishCities.find_by_population('exact', 10432)
|
|
297
375
|
TurkishCities.find_by_population('exact', 22130432)
|
298
376
|
# => []
|
299
377
|
```
|
378
|
+
</details>
|
300
379
|
|
301
380
|
### Below given
|
302
381
|
|
303
382
|
Search city name with below population
|
304
383
|
|
384
|
+
<details>
|
385
|
+
<summary>Expand</summary>
|
386
|
+
|
305
387
|
```rb
|
306
388
|
TurkishCities.find_by_population('below', 86000)
|
307
389
|
# => ["Tunceli", "Bayburt"]
|
@@ -316,11 +398,15 @@ TurkishCities.find_by_population('below', 10432)
|
|
316
398
|
TurkishCities.find_by_population('below', 22130432)
|
317
399
|
# => []
|
318
400
|
```
|
401
|
+
</details>
|
319
402
|
|
320
403
|
### Above given
|
321
404
|
|
322
405
|
Search city name with above population
|
323
406
|
|
407
|
+
<details>
|
408
|
+
<summary>Expand</summary>
|
409
|
+
|
324
410
|
```rb
|
325
411
|
TurkishCities.find_by_population('above', 860000)
|
326
412
|
# => ["Adana", "Ankara" ... "Şanlıurfa", "Van"]
|
@@ -335,11 +421,15 @@ TurkishCities.find_by_population('above', 10432)
|
|
335
421
|
TurkishCities.find_by_population('above', 22130432)
|
336
422
|
# => []
|
337
423
|
```
|
424
|
+
</details>
|
338
425
|
|
339
426
|
### Between search
|
340
427
|
|
341
428
|
Search city name with between population
|
342
429
|
|
430
|
+
<details>
|
431
|
+
<summary>Expand</summary>
|
432
|
+
|
343
433
|
```rb
|
344
434
|
TurkishCities.find_by_population('between', 15840900, 3000000)
|
345
435
|
# => ["Ankara", "Bursa", "İzmir"]
|
@@ -352,6 +442,7 @@ TurkishCities.find_by_population('between', 10432, 100000)
|
|
352
442
|
TurkishCities.find_by_population('between', 2130432, 34000000)
|
353
443
|
# => []
|
354
444
|
```
|
445
|
+
</details>
|
355
446
|
|
356
447
|
### Finding travel distance and time estimation between two cities
|
357
448
|
|
@@ -359,6 +450,9 @@ TurkishCities.find_by_population('between', 2130432, 34000000)
|
|
359
450
|
|
360
451
|
City names can be given case and turkish character insensitive. Travel method should be lower case. Array with 2 elements will be returned. First element is distance between cities in kilometers and the second element is the description created by the first element.
|
361
452
|
|
453
|
+
<details>
|
454
|
+
<summary>Expand</summary>
|
455
|
+
|
362
456
|
```rb
|
363
457
|
TurkishCities.distance_between('Eskişehir', 'Kastamonu', 'land')
|
364
458
|
# => [480, "Land travel distance between Eskişehir and Kastamonu is 480 km."]
|
@@ -373,11 +467,15 @@ TurkishCities.distance_between('Adana', 'Adıyaman', 'time')
|
|
373
467
|
TurkishCities.distance_between('filansa', 'falansa', 'land')
|
374
468
|
# => "Couldn't find cities combination with 'filansa/falansa'"
|
375
469
|
```
|
470
|
+
</details>
|
376
471
|
|
377
472
|
### By air
|
378
473
|
|
379
474
|
City names can be given case and turkish character insensitive. Travel method should be lower case. Array with 3 elements will be returned. First element is distance between cities in kilometers, the second element is estimated travel time and the last element is the description created by the first two elements.
|
380
475
|
|
476
|
+
<details>
|
477
|
+
<summary>Expand</summary>
|
478
|
+
|
381
479
|
```rb
|
382
480
|
TurkishCities.distance_between('Eskişehir', 'Kastamonu', 'air')
|
383
481
|
# => [327.74, 62, "Air travel distance between Eskişehir and Kastamonu is 327.74 km. Estimated air travel would take 62 minutes."]
|
@@ -392,6 +490,7 @@ TurkishCities.distance_between('Adana', 'Adıyaman', 'time')
|
|
392
490
|
TurkishCities.distance_between('filansa', 'falansa', 'air')
|
393
491
|
# => "Couldn't find cities combination with 'filansa/falansa'"
|
394
492
|
```
|
493
|
+
</details>
|
395
494
|
|
396
495
|
## Data sources
|
397
496
|
|
@@ -464,5 +563,5 @@ The logo is licensed under a
|
|
464
563
|
|
465
564
|
## Copyright
|
466
565
|
|
467
|
-
Copyright (c) 2020 Semih Arslanoglu. See [LICENSE.txt](LICENSE.txt) for
|
566
|
+
Copyright (c) 2020 - 2022 Semih Arslanoglu. See [LICENSE.txt](LICENSE.txt) for
|
468
567
|
further details.
|
data/Rakefile
ADDED
data/lib/turkish_cities.rb
CHANGED
@@ -9,7 +9,8 @@ require_relative '../lib/turkish_cities/version'
|
|
9
9
|
|
10
10
|
require 'i18n'
|
11
11
|
|
12
|
-
I18n.load_path <<
|
12
|
+
I18n.load_path << "#{File.expand_path('config/locales')}/en.yml"
|
13
|
+
I18n.load_path << "#{File.expand_path('config/locales')}/tr.yml"
|
13
14
|
|
14
15
|
class TurkishCities
|
15
16
|
PLATE_NUMBER = 'plate_number'
|
data/turkish_cities.gemspec
CHANGED
@@ -21,9 +21,10 @@ Gem::Specification.new do |s|
|
|
21
21
|
s.add_dependency 'i18n', ['>= 0.6.4', '<= 2']
|
22
22
|
|
23
23
|
s.add_development_dependency 'bundler', '~> 2.2.16'
|
24
|
-
s.add_development_dependency '
|
25
|
-
s.add_development_dependency '
|
26
|
-
s.add_development_dependency '
|
24
|
+
s.add_development_dependency 'codecov', '~> 0.6.0'
|
25
|
+
s.add_development_dependency 'rake', '~> 13.0.6'
|
26
|
+
s.add_development_dependency 'rspec', '~> 3.11.0'
|
27
|
+
s.add_development_dependency 'rubocop', '~> 1.27.0'
|
27
28
|
|
28
29
|
if s.respond_to?(:metadata)
|
29
30
|
s.metadata['changelog_uri'] = 'https://github.com/sarslanoglu/turkish_cities/blob/master/CHANGELOG.md'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: turkish_cities
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Semih Arslanoglu
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-07-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: i18n
|
@@ -45,47 +45,61 @@ dependencies:
|
|
45
45
|
- !ruby/object:Gem::Version
|
46
46
|
version: 2.2.16
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
|
-
name:
|
48
|
+
name: codecov
|
49
49
|
requirement: !ruby/object:Gem::Requirement
|
50
50
|
requirements:
|
51
51
|
- - "~>"
|
52
52
|
- !ruby/object:Gem::Version
|
53
|
-
version: 0.
|
53
|
+
version: 0.6.0
|
54
54
|
type: :development
|
55
55
|
prerelease: false
|
56
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
57
|
requirements:
|
58
58
|
- - "~>"
|
59
59
|
- !ruby/object:Gem::Version
|
60
|
-
version: 0.
|
60
|
+
version: 0.6.0
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: rake
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - "~>"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: 13.0.6
|
68
|
+
type: :development
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - "~>"
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: 13.0.6
|
61
75
|
- !ruby/object:Gem::Dependency
|
62
76
|
name: rspec
|
63
77
|
requirement: !ruby/object:Gem::Requirement
|
64
78
|
requirements:
|
65
79
|
- - "~>"
|
66
80
|
- !ruby/object:Gem::Version
|
67
|
-
version: 3.
|
81
|
+
version: 3.11.0
|
68
82
|
type: :development
|
69
83
|
prerelease: false
|
70
84
|
version_requirements: !ruby/object:Gem::Requirement
|
71
85
|
requirements:
|
72
86
|
- - "~>"
|
73
87
|
- !ruby/object:Gem::Version
|
74
|
-
version: 3.
|
88
|
+
version: 3.11.0
|
75
89
|
- !ruby/object:Gem::Dependency
|
76
90
|
name: rubocop
|
77
91
|
requirement: !ruby/object:Gem::Requirement
|
78
92
|
requirements:
|
79
93
|
- - "~>"
|
80
94
|
- !ruby/object:Gem::Version
|
81
|
-
version: 1.
|
95
|
+
version: 1.27.0
|
82
96
|
type: :development
|
83
97
|
prerelease: false
|
84
98
|
version_requirements: !ruby/object:Gem::Requirement
|
85
99
|
requirements:
|
86
100
|
- - "~>"
|
87
101
|
- !ruby/object:Gem::Version
|
88
|
-
version: 1.
|
102
|
+
version: 1.27.0
|
89
103
|
description: List and find Turkish cities via name, district name, post code, plate
|
90
104
|
number. Calculate air travel distance between cities and get realistic estimates
|
91
105
|
of travel time
|
@@ -94,11 +108,13 @@ executables: []
|
|
94
108
|
extensions: []
|
95
109
|
extra_rdoc_files: []
|
96
110
|
files:
|
111
|
+
- ".circleci/config.yml"
|
97
112
|
- ".codeclimate.yml"
|
98
113
|
- ".github/ISSUE_TEMPLATE/bug_report.md"
|
99
114
|
- ".github/ISSUE_TEMPLATE/feature_request.md"
|
100
115
|
- ".github/dependabot.yml"
|
101
116
|
- ".github/pull_request_template.md"
|
117
|
+
- ".github/workflows/ruby.yml"
|
102
118
|
- ".gitignore"
|
103
119
|
- ".hound.yml"
|
104
120
|
- ".rspec"
|
@@ -110,6 +126,7 @@ files:
|
|
110
126
|
- Gemfile.lock
|
111
127
|
- LICENSE.txt
|
112
128
|
- README.md
|
129
|
+
- Rakefile
|
113
130
|
- config/locales/en.yml
|
114
131
|
- config/locales/tr.yml
|
115
132
|
- lib/turkish_cities.rb
|
@@ -232,7 +249,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
232
249
|
- !ruby/object:Gem::Version
|
233
250
|
version: '0'
|
234
251
|
requirements: []
|
235
|
-
rubygems_version: 3.2.
|
252
|
+
rubygems_version: 3.2.3
|
236
253
|
signing_key:
|
237
254
|
specification_version: 4
|
238
255
|
summary: List and find Turkish cities
|