turkish_cities 0.1.2 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.codeclimate.yml +5 -0
- data/.github/ISSUE_TEMPLATE/bug_report.md +22 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- data/.github/pull_request_template.md +38 -0
- data/.hound.yml +1 -1
- data/.rubocop.yml +6 -10
- data/.travis.yml +9 -0
- data/CHANGELOG.md +61 -3
- data/CONTRIBUTING.md +38 -0
- data/Gemfile +0 -1
- data/Gemfile.lock +32 -29
- data/README.md +290 -33
- data/lib/turkish_cities.rb +34 -3
- data/lib/turkish_cities/city.rb +47 -28
- data/lib/turkish_cities/data/cities.yaml +643 -1
- data/lib/turkish_cities/data/districts/adana.yaml +1043 -0
- data/lib/turkish_cities/data/districts/adiyaman.yaml +1243 -0
- data/lib/turkish_cities/data/districts/afyon.yaml +1253 -0
- data/lib/turkish_cities/data/districts/agri.yaml +1038 -0
- data/lib/turkish_cities/data/districts/aksaray.yaml +491 -0
- data/lib/turkish_cities/data/districts/amasya.yaml +753 -0
- data/lib/turkish_cities/data/districts/ankara.yaml +1712 -0
- data/lib/turkish_cities/data/districts/antalya.yaml +1114 -0
- data/lib/turkish_cities/data/districts/ardahan.yaml +396 -0
- data/lib/turkish_cities/data/districts/artvin.yaml +1956 -0
- data/lib/turkish_cities/data/districts/aydin.yaml +761 -0
- data/lib/turkish_cities/data/districts/balikesir.yaml +1338 -0
- data/lib/turkish_cities/data/districts/bartin.yaml +1065 -0
- data/lib/turkish_cities/data/districts/batman.yaml +790 -0
- data/lib/turkish_cities/data/districts/bayburt.yaml +263 -0
- data/lib/turkish_cities/data/districts/bilecik.yaml +425 -0
- data/lib/turkish_cities/data/districts/bingol.yaml +1159 -0
- data/lib/turkish_cities/data/districts/bitlis.yaml +818 -0
- data/lib/turkish_cities/data/districts/bolu.yaml +1730 -0
- data/lib/turkish_cities/data/districts/burdur.yaml +592 -0
- data/lib/turkish_cities/data/districts/bursa.yaml +1266 -0
- data/lib/turkish_cities/data/districts/canakkale.yaml +1035 -0
- data/lib/turkish_cities/data/districts/cankiri.yaml +719 -0
- data/lib/turkish_cities/data/districts/corum.yaml +1576 -0
- data/lib/turkish_cities/data/districts/denizli.yaml +724 -0
- data/lib/turkish_cities/data/districts/diyarbakir.yaml +1132 -0
- data/lib/turkish_cities/data/districts/duzce.yaml +756 -0
- data/lib/turkish_cities/data/districts/edirne.yaml +457 -0
- data/lib/turkish_cities/data/districts/elazig.yaml +1560 -0
- data/lib/turkish_cities/data/districts/erzincan.yaml +1086 -0
- data/lib/turkish_cities/data/districts/erzurum.yaml +1278 -0
- data/lib/turkish_cities/data/districts/eskisehir.yaml +673 -0
- data/lib/turkish_cities/data/districts/gaziantep.yaml +872 -0
- data/lib/turkish_cities/data/districts/giresun.yaml +2753 -0
- data/lib/turkish_cities/data/districts/gumushane.yaml +1185 -0
- data/lib/turkish_cities/data/districts/hakkari.yaml +478 -0
- data/lib/turkish_cities/data/districts/hatay.yaml +680 -0
- data/lib/turkish_cities/data/districts/igdir.yaml +272 -0
- data/lib/turkish_cities/data/districts/isparta.yaml +676 -0
- data/lib/turkish_cities/data/districts/istanbul.yaml +1812 -0
- data/lib/turkish_cities/data/districts/izmir.yaml +1657 -0
- data/lib/turkish_cities/data/districts/kahramanmaras.yaml +776 -0
- data/lib/turkish_cities/data/districts/karabuk.yaml +1171 -0
- data/lib/turkish_cities/data/districts/karaman.yaml +477 -0
- data/lib/turkish_cities/data/districts/kars.yaml +572 -0
- data/lib/turkish_cities/data/districts/kastamonu.yaml +4485 -0
- data/lib/turkish_cities/data/districts/kayseri.yaml +852 -0
- data/lib/turkish_cities/data/districts/kilis.yaml +328 -0
- data/lib/turkish_cities/data/districts/kirikkale.yaml +423 -0
- data/lib/turkish_cities/data/districts/kirklareli.yaml +384 -0
- data/lib/turkish_cities/data/districts/kirsehir.yaml +475 -0
- data/lib/turkish_cities/data/districts/kocaeli.yaml +597 -0
- data/lib/turkish_cities/data/districts/konya.yaml +1418 -0
- data/lib/turkish_cities/data/districts/kutahya.yaml +1042 -0
- data/lib/turkish_cities/data/districts/malatya.yaml +828 -0
- data/lib/turkish_cities/data/districts/manisa.yaml +1318 -0
- data/lib/turkish_cities/data/districts/mardin.yaml +762 -0
- data/lib/turkish_cities/data/districts/mersin.yaml +1013 -0
- data/lib/turkish_cities/data/districts/mugla.yaml +622 -0
- data/lib/turkish_cities/data/districts/mus.yaml +749 -0
- data/lib/turkish_cities/data/districts/nevsehir.yaml +481 -0
- data/lib/turkish_cities/data/districts/nigde.yaml +437 -0
- data/lib/turkish_cities/data/districts/ordu.yaml +857 -0
- data/lib/turkish_cities/data/districts/osmaniye.yaml +655 -0
- data/lib/turkish_cities/data/districts/rize.yaml +1447 -0
- data/lib/turkish_cities/data/districts/sakarya.yaml +744 -0
- data/lib/turkish_cities/data/districts/samsun.yaml +1363 -0
- data/lib/turkish_cities/data/districts/sanliurfa.yaml +1505 -0
- data/lib/turkish_cities/data/districts/siirt.yaml +579 -0
- data/lib/turkish_cities/data/districts/sinop.yaml +2061 -0
- data/lib/turkish_cities/data/districts/sirnak.yaml +404 -0
- data/lib/turkish_cities/data/districts/sivas.yaml +2476 -0
- data/lib/turkish_cities/data/districts/tekirdag.yaml +436 -0
- data/lib/turkish_cities/data/districts/tokat.yaml +1553 -0
- data/lib/turkish_cities/data/districts/trabzon.yaml +794 -0
- data/lib/turkish_cities/data/districts/tunceli.yaml +1074 -0
- data/lib/turkish_cities/data/districts/usak.yaml +735 -0
- data/lib/turkish_cities/data/districts/van.yaml +754 -0
- data/lib/turkish_cities/data/districts/yalova.yaml +151 -0
- data/lib/turkish_cities/data/districts/yozgat.yaml +939 -0
- data/lib/turkish_cities/data/districts/zonguldak.yaml +1599 -0
- data/lib/turkish_cities/data/neighborhoods_parser.rb +52 -0
- data/lib/turkish_cities/distance.rb +131 -0
- data/lib/turkish_cities/district.rb +53 -0
- data/lib/turkish_cities/helpers/decomposer_helper.rb +104 -0
- data/lib/turkish_cities/postcode.rb +25 -0
- data/lib/turkish_cities/version.rb +1 -1
- data/public/assets/img/TurkishCities_darkblue-on-yellow_800X800@3x-8.png +0 -0
- data/public/assets/img/TurkishCities_darkblue-on-yellow_914X343@3x-8.png +0 -0
- data/public/assets/img/TurkishCities_darkblue-on-yellow_horizontal_914X343@3x-8.png +0 -0
- data/public/assets/img/TurkishCities_yellow-on-darkblue_800X800@3x-8.png +0 -0
- data/public/assets/img/TurkishCities_yellow-on-darkblue_914X343@3x-8.png +0 -0
- data/public/assets/img/TurkishCities_yellow-on-darkblue_horizontal_914X343@3x-8.png +0 -0
- data/turkish_cities.gemspec +4 -4
- metadata +108 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 14e3cb00362c30c66924e86fb009a79dd9ef16b086166ec0eb1be136653e7cc7
|
4
|
+
data.tar.gz: a1b61fbd9f3319d5973acf35b029bb315460b83d0d8ebcfb15d30405eab0e6cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a0d5834616ddfe7cf080efd3182d599f7901a1d139f831aa85a7ff81d66498bb2ad8a2e118e9c935fadf679cb86f249ae6210f986a38408a1d21c8e5e313b17
|
7
|
+
data.tar.gz: ea17bd392eb05c6bfa1413cc0754d749a2dc53874d5944bc37603c98cf2f65c9de9c9c9a68d208bcbde738c73f59e9b09740f23d5899526ff7a8080e15732197
|
data/.codeclimate.yml
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
---
|
2
|
+
name: Bug report
|
3
|
+
about: Create a report to help us improve
|
4
|
+
title: "[BUG] - (Fill here)"
|
5
|
+
labels: bug
|
6
|
+
assignees: ''
|
7
|
+
|
8
|
+
---
|
9
|
+
|
10
|
+
**Describe the bug**
|
11
|
+
A clear and concise description of what the bug is.
|
12
|
+
|
13
|
+
**To Reproduce**
|
14
|
+
Steps to reproduce the behavior:
|
15
|
+
1. In terminal ```require 'turkish_cities'```
|
16
|
+
2. Call method ```'....'```
|
17
|
+
|
18
|
+
**Expected behavior**
|
19
|
+
A clear and concise description of what you expected to happen.
|
20
|
+
|
21
|
+
**Additional context**
|
22
|
+
Add any other context about the problem here.
|
@@ -0,0 +1,20 @@
|
|
1
|
+
---
|
2
|
+
name: Feature request
|
3
|
+
about: Suggest an idea for this project
|
4
|
+
title: "[FEAT] - (Fill here)"
|
5
|
+
labels: enhancement
|
6
|
+
assignees: ''
|
7
|
+
|
8
|
+
---
|
9
|
+
|
10
|
+
**Is your feature request related to a problem? Please describe.**
|
11
|
+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
12
|
+
|
13
|
+
**Describe the solution you'd like**
|
14
|
+
A clear and concise description of what you want to happen.
|
15
|
+
|
16
|
+
**Describe alternatives you've considered**
|
17
|
+
A clear and concise description of any alternative solutions or features you've considered.
|
18
|
+
|
19
|
+
**Additional context**
|
20
|
+
Add any other context or screenshots about the feature request here.
|
@@ -0,0 +1,38 @@
|
|
1
|
+
### Related github issue for this PR
|
2
|
+
|
3
|
+
Resolves #001 <!--fill issue number-->
|
4
|
+
|
5
|
+
### Checklist
|
6
|
+
|
7
|
+
* [ ] I have performed a self-review of my own code
|
8
|
+
* [ ] I added comments, particularly in hard-to-understand areas
|
9
|
+
* [ ] I have made corresponding changes to the documentation `README.md`
|
10
|
+
* [ ] I added tests that prove my fix is effective or that my feature works
|
11
|
+
* [ ] `bundle exec rake` passes locally
|
12
|
+
* [ ] `rubocop` gives no error locally
|
13
|
+
* [ ] My PR title includes "WIP" or is [draft PR](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/about-pull-requests#draft-pull-requests) if work is in progress
|
14
|
+
|
15
|
+
### Description
|
16
|
+
|
17
|
+
<!-- Please include a summary of the change and which issue is fixed.
|
18
|
+
Please also include relevant motivation and context.
|
19
|
+
Guide questions:
|
20
|
+
- What changed, and why?
|
21
|
+
- What alternative solutions did you consider?
|
22
|
+
- What are the tradeoffs for your solution?
|
23
|
+
|
24
|
+
Include anything else we should know about. -->
|
25
|
+
|
26
|
+
### Type of change
|
27
|
+
|
28
|
+
<!-- Please delete options that are not relevant. -->
|
29
|
+
|
30
|
+
* Bug fix (non-breaking change which fixes an issue)
|
31
|
+
* New feature (non-breaking change which adds functionality)
|
32
|
+
* Breaking change (fix or feature that would cause existing functionality to not
|
33
|
+
work as expected)
|
34
|
+
* Documentation update
|
35
|
+
|
36
|
+
### Which tests are written for this PR? And what are the expected results for these tests?
|
37
|
+
|
38
|
+
<!-- Please describe the tests that you ran to verify your changes. -->
|
data/.hound.yml
CHANGED
data/.rubocop.yml
CHANGED
@@ -3,18 +3,14 @@ AllCops:
|
|
3
3
|
Exclude:
|
4
4
|
- 'Gemfile'
|
5
5
|
- 'turkish_cities.gemspec'
|
6
|
+
NewCops: enable
|
6
7
|
Layout/LineLength:
|
7
|
-
Max:
|
8
|
+
Max: 120
|
9
|
+
Metrics/AbcSize:
|
10
|
+
Max: 20
|
8
11
|
Metrics/BlockLength:
|
9
12
|
ExcludedMethods: ['describe', 'context']
|
13
|
+
Metrics/MethodLength:
|
14
|
+
Max: 15
|
10
15
|
Style/Documentation:
|
11
16
|
Enabled: false
|
12
|
-
Style/HashEachMethods:
|
13
|
-
Enabled: true
|
14
|
-
Style/HashTransformKeys:
|
15
|
-
Description: 'Prefer `transform_keys` over `each_with_object` and `map`.'
|
16
|
-
Enabled: true
|
17
|
-
Style/HashTransformValues:
|
18
|
-
Description: 'Prefer `transform_values` over `each_with_object` and `map`.'
|
19
|
-
Enabled: true
|
20
|
-
|
data/.travis.yml
CHANGED
@@ -1,3 +1,6 @@
|
|
1
|
+
env:
|
2
|
+
global:
|
3
|
+
- CC_TEST_REPORTER_ID=23062197f289fd0ae7601ae06c2dd4a0af4e16c436f2428b99ab4b64a7e4a587
|
1
4
|
language: ruby
|
2
5
|
dist: trusty
|
3
6
|
rvm:
|
@@ -6,7 +9,13 @@ rvm:
|
|
6
9
|
- 2.7
|
7
10
|
before_install:
|
8
11
|
- gem install bundler
|
12
|
+
before_script:
|
13
|
+
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
14
|
+
- chmod +x ./cc-test-reporter
|
15
|
+
- ./cc-test-reporter before-build
|
9
16
|
script: bundle exec rspec spec
|
17
|
+
after_script:
|
18
|
+
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|
10
19
|
notifications:
|
11
20
|
email:
|
12
21
|
- arslanoglusemih93@gmail.com
|
data/CHANGELOG.md
CHANGED
@@ -1,18 +1,76 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## 0.4.0 (2021-04-25)
|
4
|
+
|
5
|
+
### New features
|
6
|
+
|
7
|
+
* [#66](https://github.com/sarslanoglu/turkish_cities/issues/66): Add ```distance_between_land``` method for calculating land travel distances between cities
|
8
|
+
|
9
|
+
## 0.3.0 (2020-11-22)
|
10
|
+
|
11
|
+
### New features
|
12
|
+
|
13
|
+
* [#13](https://github.com/sarslanoglu/turkish_cities/issues/13): Add ```distance``` class and ```distance_between``` method for calculating air travel distance and time estimation between cities
|
14
|
+
|
15
|
+
### Changes
|
16
|
+
|
17
|
+
* [#50](https://github.com/sarslanoglu/turkish_cities/issues/50): Additional improvements on `District` class methods
|
18
|
+
|
19
|
+
* [#45](https://github.com/sarslanoglu/turkish_cities/issues/45): Refactor `District` class
|
20
|
+
|
21
|
+
## 0.2.1 (2020-06-29)
|
22
|
+
|
23
|
+
### Bug fixes
|
24
|
+
|
25
|
+
* [#38](https://github.com/sarslanoglu/turkish_cities/issues/38): ```NoMethodError``` on ```list_neighborhoods``` when called with wrong subdistrict name
|
26
|
+
|
27
|
+
### Changes
|
28
|
+
|
29
|
+
* [#39](https://github.com/sarslanoglu/turkish_cities/issues/39): May maintenance of gem - 2020-05-24
|
30
|
+
|
31
|
+
## 0.2.0 (2020-05-18)
|
32
|
+
|
33
|
+
### New features
|
34
|
+
|
35
|
+
* [#36](https://github.com/sarslanoglu/turkish_cities/issues/36): Add ```postcode``` class and ```find_by_postcode``` method for finding city, district and subdistrict information by given postcode
|
36
|
+
|
37
|
+
* [#33](https://github.com/sarslanoglu/turkish_cities/issues/33): Add ```list_neighborhoods``` method for listing neighborhoods and fix some wrong district names
|
38
|
+
|
39
|
+
* [#29](https://github.com/sarslanoglu/turkish_cities/issues/29): Add ```district``` class and ```list_subdistricts``` method for listing subdistricts
|
40
|
+
|
41
|
+
* [#27](https://github.com/sarslanoglu/turkish_cities/issues/27): Add all subdistricts and neighborhoods of all Turkish cities
|
42
|
+
|
43
|
+
* [#25](https://github.com/sarslanoglu/turkish_cities/issues/25): Add district data to each city at yaml file and add new method ```list_districts``` for listing disctricts of cities alphabetically sorted
|
44
|
+
|
45
|
+
### Changes
|
46
|
+
|
47
|
+
* [#24](https://github.com/sarslanoglu/turkish_cities/issues/24): Add listing support with ```metropolitan_municipality_since, phone_code, plate_number, region``` to ```listing_cities``` method
|
48
|
+
|
49
|
+
## 0.1.3 (2020-04-20)
|
50
|
+
|
51
|
+
### New features
|
52
|
+
|
53
|
+
* [#22](https://github.com/sarslanoglu/turkish_cities/issues/22): Add region data to cities.yaml and update ```list_cities``` method to support regions
|
54
|
+
|
55
|
+
* [#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
|
56
|
+
|
57
|
+
### Bug fixes
|
58
|
+
|
59
|
+
* [#18](https://github.com/sarslanoglu/turkish_cities/issues/18): Fix yaml file read error while deploying apps to Heroku
|
60
|
+
|
3
61
|
## 0.1.2 (2020-04-13)
|
4
62
|
|
5
63
|
### New features
|
6
64
|
|
7
|
-
* [#
|
65
|
+
* [#3](https://github.com/sarslanoglu/turkish_cities/issues/3): Change city_list data to yaml file format
|
8
66
|
|
9
67
|
### Bug fixes
|
10
68
|
|
11
|
-
* [#
|
69
|
+
* [#2](https://github.com/sarslanoglu/turkish_cities/issues/2): Fix capital Turkish characters bug on cities with capital 'I' letter
|
12
70
|
|
13
71
|
### Changes
|
14
72
|
|
15
|
-
* [#
|
73
|
+
* [#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
74
|
|
17
75
|
## 0.1.1 (2020-03-31)
|
18
76
|
|
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
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
turkish_cities (0.
|
4
|
+
turkish_cities (0.4.0)
|
5
5
|
i18n (>= 0.6.4, <= 2)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
ast (2.4.
|
10
|
+
ast (2.4.1)
|
11
11
|
concurrent-ruby (1.1.6)
|
12
12
|
coveralls (0.8.23)
|
13
13
|
json (>= 1.8, < 3)
|
@@ -15,38 +15,41 @@ GEM
|
|
15
15
|
term-ansicolor (~> 1.3)
|
16
16
|
thor (>= 0.19.4, < 2.0)
|
17
17
|
tins (~> 1.6)
|
18
|
-
diff-lcs (1.
|
18
|
+
diff-lcs (1.4.4)
|
19
19
|
docile (1.3.2)
|
20
|
-
i18n (1.8.
|
20
|
+
i18n (1.8.5)
|
21
21
|
concurrent-ruby (~> 1.0)
|
22
|
-
jaro_winkler (1.5.4)
|
23
22
|
json (2.3.0)
|
24
|
-
parallel (1.
|
25
|
-
parser (2.7.
|
26
|
-
ast (~> 2.4.
|
23
|
+
parallel (1.20.0)
|
24
|
+
parser (2.7.2.0)
|
25
|
+
ast (~> 2.4.1)
|
27
26
|
rainbow (3.0.0)
|
27
|
+
regexp_parser (1.8.2)
|
28
28
|
rexml (3.2.4)
|
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.
|
29
|
+
rspec (3.10.0)
|
30
|
+
rspec-core (~> 3.10.0)
|
31
|
+
rspec-expectations (~> 3.10.0)
|
32
|
+
rspec-mocks (~> 3.10.0)
|
33
|
+
rspec-core (3.10.0)
|
34
|
+
rspec-support (~> 3.10.0)
|
35
|
+
rspec-expectations (3.10.0)
|
36
36
|
diff-lcs (>= 1.2.0, < 2.0)
|
37
|
-
rspec-support (~> 3.
|
38
|
-
rspec-mocks (3.
|
37
|
+
rspec-support (~> 3.10.0)
|
38
|
+
rspec-mocks (3.10.0)
|
39
39
|
diff-lcs (>= 1.2.0, < 2.0)
|
40
|
-
rspec-support (~> 3.
|
41
|
-
rspec-support (3.
|
42
|
-
rubocop (
|
43
|
-
jaro_winkler (~> 1.5.1)
|
40
|
+
rspec-support (~> 3.10.0)
|
41
|
+
rspec-support (3.10.0)
|
42
|
+
rubocop (1.3.1)
|
44
43
|
parallel (~> 1.10)
|
45
|
-
parser (>= 2.7.
|
44
|
+
parser (>= 2.7.1.5)
|
46
45
|
rainbow (>= 2.2.2, < 4.0)
|
46
|
+
regexp_parser (>= 1.8)
|
47
47
|
rexml
|
48
|
+
rubocop-ast (>= 1.1.1)
|
48
49
|
ruby-progressbar (~> 1.7)
|
49
|
-
unicode-display_width (>= 1.4.0, <
|
50
|
+
unicode-display_width (>= 1.4.0, < 2.0)
|
51
|
+
rubocop-ast (1.1.1)
|
52
|
+
parser (>= 2.7.1.5)
|
50
53
|
ruby-progressbar (1.10.1)
|
51
54
|
simplecov (0.16.1)
|
52
55
|
docile (~> 1.1)
|
@@ -57,19 +60,19 @@ GEM
|
|
57
60
|
term-ansicolor (1.7.1)
|
58
61
|
tins (~> 1.0)
|
59
62
|
thor (1.0.1)
|
60
|
-
tins (1.
|
63
|
+
tins (1.25.0)
|
61
64
|
sync
|
62
|
-
unicode-display_width (1.
|
65
|
+
unicode-display_width (1.7.0)
|
63
66
|
|
64
67
|
PLATFORMS
|
65
68
|
ruby
|
66
69
|
|
67
70
|
DEPENDENCIES
|
68
|
-
bundler (~> 2.
|
71
|
+
bundler (~> 2.2.16)
|
69
72
|
coveralls (~> 0.8.23)
|
70
|
-
rspec (~> 3.
|
71
|
-
rubocop (~>
|
73
|
+
rspec (~> 3.10.0)
|
74
|
+
rubocop (~> 1.3.1)
|
72
75
|
turkish_cities!
|
73
76
|
|
74
77
|
BUNDLED WITH
|
75
|
-
2.
|
78
|
+
2.2.16
|
data/README.md
CHANGED
@@ -1,12 +1,47 @@
|
|
1
|
-
#
|
2
|
-
[![Gem Version](https://badge.fury.io/rb/turkish_cities.svg)](https://rubygems.org/gems/turkish_cities)
|
3
|
-
[![Build Status](https://travis-ci.org/sarslanoglu/turkish_cities.svg?branch=master)](https://travis-ci.org/sarslanoglu/turkish_cities)
|
4
|
-
[![Code Climate](https://codeclimate.com/github/sarslanoglu/turkish_cities.svg)](https://codeclimate.com/github/sarslanoglu/turkish_cities)
|
5
|
-
[![Coverage Status](https://coveralls.io/repos/github/sarslanoglu/turkish_cities/badge.svg?branch=master)](https://coveralls.io/github/sarslanoglu/turkish_cities?branch=master)
|
6
|
-
[![Protected by Hound](https://img.shields.io/badge/Protected_by-Hound-a873d1.svg)](https://houndci.com)
|
7
|
-
[![License](https://img.shields.io/github/license/sarslanoglu/turkish_cities.svg)](https://opensource.org/licenses/MIT)
|
1
|
+
# ![TurkishCities](./public/assets/img/TurkishCities_yellow-on-darkblue_horizontal_914X343@3x-8.png)
|
8
2
|
|
9
|
-
|
3
|
+
<p align="center">
|
4
|
+
<a href="https://rubygems.org/gems/turkish_cities">
|
5
|
+
<img src="https://badge.fury.io/rb/turkish_cities.svg" alt="GemVersion"/></a>
|
6
|
+
<a href="https://travis-ci.org/sarslanoglu/turkish_cities">
|
7
|
+
<img src="https://travis-ci.org/sarslanoglu/turkish_cities.svg?branch=master" alt="BuildStatus"/></a>
|
8
|
+
<a href="https://coveralls.io/github/sarslanoglu/turkish_cities?branch=master">
|
9
|
+
<img src="https://coveralls.io/repos/github/sarslanoglu/turkish_cities/badge.svg?branch=master" alt="CoverageStatus"/></a>
|
10
|
+
<a href="https://codeclimate.com/github/sarslanoglu/turkish_cities/maintainability">
|
11
|
+
<img src="https://api.codeclimate.com/v1/badges/c1dbe0cef353b152956e/maintainability" alt="Maintainability"/></a>
|
12
|
+
<a href="https://houndci.com">
|
13
|
+
<img src="https://img.shields.io/badge/Protected_by-Hound-a873d1.svg" alt="Hound"/></a>
|
14
|
+
<a href="https://opensource.org/licenses/MIT">
|
15
|
+
<img src="https://img.shields.io/github/license/sarslanoglu/turkish_cities.svg" alt="License"/></a>
|
16
|
+
</p>
|
17
|
+
|
18
|
+
**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.
|
19
|
+
https://rubygems.org/gems/turkish_cities
|
20
|
+
|
21
|
+
## Table of Contents
|
22
|
+
* [Installation](#installation)
|
23
|
+
* [Documentation](#documentation)
|
24
|
+
* [Finding city name by plate number](#finding-city-name-by-plate-number)
|
25
|
+
* [Finding city name by phone code](#finding-city-name-by-phone-code)
|
26
|
+
* [Finding plate number by city name](#finding-plate-number-by-city-name)
|
27
|
+
* [Finding phone code by city name](#finding-phone-code-by-city-name)
|
28
|
+
* [Listing all cities](#listing-all-cities)
|
29
|
+
* [Listing all cities with only name](#listing-all-cities-with-only-name)
|
30
|
+
* [Listing all cities with other parameters](#listing-all-cities-with-other-parameters)
|
31
|
+
* [Listing all districts of given city](#listing-all-districts-of-given-city)
|
32
|
+
* [Listing all subdistricts of given city and district](#listing-all-subdistricts-of-given-city-and-district)
|
33
|
+
* [Listing all neighborhoods of given city and district](#listing-all-neighborhoods-of-given-city-and-district)
|
34
|
+
* [With subdistrict info](#with-subdistrict-info)
|
35
|
+
* [Without subdistrict info](#without-subdistrict-info)
|
36
|
+
* [Finding city, district and subdistrict name by postcode](#finding-city-district-and-subdistrict-name-by-postcode)
|
37
|
+
* [Finding travel distance and time estimation between two cities](#finding-travel-distance-and-time-estimation-between-two-cities)
|
38
|
+
* [By land](#by-land)
|
39
|
+
* [By air](#by-air)
|
40
|
+
* [Data sources](#data-sources)
|
41
|
+
* [Compatibility](#compatibility)
|
42
|
+
* [Contributing](#contributing)
|
43
|
+
* [Changelog](#changelog)
|
44
|
+
* [Copyright](#copyright)
|
10
45
|
|
11
46
|
## Installation
|
12
47
|
|
@@ -32,73 +67,295 @@ $ bundle
|
|
32
67
|
|
33
68
|
With using irb just require gem and start using
|
34
69
|
|
35
|
-
```
|
70
|
+
```rb
|
36
71
|
require 'turkish_cities'
|
37
72
|
```
|
38
73
|
|
39
74
|
### Finding city name by plate number
|
40
75
|
|
41
|
-
There are 81 cities in Turkey. By calling a plate number between 1-81 will give city_name
|
76
|
+
There are 81 cities in Turkey. By calling a plate number between 1-81 will give city_name.
|
42
77
|
|
43
|
-
```
|
44
|
-
TurkishCities.find_name_by_plate_number(26)
|
45
|
-
TurkishCities.find_name_by_plate_number(7)
|
78
|
+
```rb
|
79
|
+
TurkishCities.find_name_by_plate_number(26) # => "Eskişehir"
|
80
|
+
TurkishCities.find_name_by_plate_number(7) # => "Antalya"
|
46
81
|
TurkishCities.find_name_by_plate_number(0007) # => "Antalya"
|
47
82
|
TurkishCities.find_name_by_plate_number(43.0) # => "Kütahya"
|
48
83
|
TurkishCities.find_name_by_plate_number('78') # => "Karabük"
|
49
|
-
TurkishCities.find_name_by_plate_number(100)
|
84
|
+
TurkishCities.find_name_by_plate_number(100) # => 'Given value [100] is outside bounds of 1 to 81.'
|
85
|
+
```
|
86
|
+
|
87
|
+
### Finding city name by phone code
|
88
|
+
|
89
|
+
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.
|
90
|
+
|
91
|
+
```rb
|
92
|
+
TurkishCities.find_name_by_phone_code(312) # => "Ankara"
|
93
|
+
TurkishCities.find_name_by_phone_code(242) # => "Antalya"
|
94
|
+
TurkishCities.find_name_by_phone_code(000222) # => "Eskişehir"
|
95
|
+
TurkishCities.find_name_by_phone_code(274.0) # => "Kütahya"
|
96
|
+
TurkishCities.find_name_by_phone_code('212') # => "İstanbul"
|
97
|
+
TurkishCities.find_name_by_phone_code(216) # => "İstanbul"
|
98
|
+
TurkishCities.find_name_by_phone_code(360) # => 'Couldn't find city name with phone code 360'
|
99
|
+
TurkishCities.find_name_by_phone_code(0) # => 'Given value [0] is outside bounds of 212 to 488.'
|
100
|
+
TurkishCities.find_name_by_phone_code(213) # => 'Given value [213] must be an even number.'
|
50
101
|
```
|
51
102
|
|
52
103
|
### Finding plate number by city name
|
53
104
|
|
54
|
-
City name can be given case and turkish character insensitive
|
105
|
+
City name can be given case and turkish character insensitive.
|
55
106
|
|
56
|
-
```
|
57
|
-
TurkishCities.find_plate_number_by_name('Ankara')
|
58
|
-
TurkishCities.find_plate_number_by_name('Eskişehir')
|
59
|
-
TurkishCities.find_plate_number_by_name('Canakkale')
|
60
|
-
TurkishCities.find_plate_number_by_name('
|
107
|
+
```rb
|
108
|
+
TurkishCities.find_plate_number_by_name('Ankara') # => 6
|
109
|
+
TurkishCities.find_plate_number_by_name('Eskişehir') # => 26
|
110
|
+
TurkishCities.find_plate_number_by_name('Canakkale') # => 17
|
111
|
+
TurkishCities.find_plate_number_by_name('Istanbul') # => 34
|
112
|
+
TurkishCities.find_plate_number_by_name('kirsehir') # => 40
|
61
113
|
TurkishCities.find_plate_number_by_name('falansehir') # => "Couldn't find city name with 'falansehir'"
|
62
114
|
```
|
63
115
|
|
116
|
+
### Finding phone code by city name
|
117
|
+
|
118
|
+
City name can be given case and turkish character insensitive.
|
119
|
+
|
120
|
+
```rb
|
121
|
+
TurkishCities.find_phone_code_by_name('Ankara') # => 312
|
122
|
+
TurkishCities.find_phone_code_by_name('Eskişehir') # => 222
|
123
|
+
TurkishCities.find_phone_code_by_name('Canakkale') # => 286
|
124
|
+
TurkishCities.find_phone_code_by_name('Istanbul') # => [212, 216]
|
125
|
+
TurkishCities.find_phone_code_by_name('kirsehir') # => 386
|
126
|
+
TurkishCities.find_phone_code_by_name('filansehir') # => "Couldn't find city name with 'filansehir'"
|
127
|
+
```
|
128
|
+
|
64
129
|
### Listing all cities
|
65
130
|
|
66
131
|
By default cities will be listed by their plate number ascending.
|
67
132
|
|
68
|
-
```
|
133
|
+
```rb
|
69
134
|
TurkishCities.list_cities # => ["Adana", "Adıyaman" ... "Kilis", "Osmaniye", "Düzce"]
|
70
135
|
```
|
71
136
|
|
72
|
-
|
137
|
+
### Listing all cities with only name
|
138
|
+
|
139
|
+
While listing cities three additional parameters can be sent ```alphabetically_sorted```, ```metropolitan_municipality``` and ```region```. All parameters can be sent separately and together.
|
73
140
|
|
74
|
-
```
|
141
|
+
```rb
|
75
142
|
TurkishCities.list_cities({ alphabetically_sorted: true })
|
76
143
|
# => ["Adana", "Adıyaman" ... "Yalova", "Yozgat", "Zonguldak"]
|
77
144
|
TurkishCities.list_cities({ metropolitan_municipality: true })
|
78
145
|
# => ["Adana", "Ankara" ... "Trabzon", "Şanlıurfa", "Van"]
|
146
|
+
TurkishCities.list_cities({ region: 'Karadeniz' })
|
147
|
+
# => ["Amasya", "Artvin" ... "Bartın", "Karabük", "Düzce"]
|
148
|
+
TurkishCities.list_cities({ alphabetically_sorted: true, region: 'Karadeniz' })
|
149
|
+
# => ["Amasya", "Artvin" ... "Tokat", "Trabzon", "Zonguldak"]
|
150
|
+
TurkishCities.list_cities({ metropolitan_municipality: true, region: 'Karadeniz' })
|
151
|
+
# => ["Ordu", "Samsun", "Trabzon"]
|
79
152
|
TurkishCities.list_cities({ alphabetically_sorted: true, metropolitan_municipality: true })
|
80
153
|
# => ["Adana", "Ankara" ... "Tekirdağ", "Trabzon", "Van"]
|
81
154
|
```
|
82
155
|
|
156
|
+
### Listing all cities with other parameters
|
157
|
+
|
158
|
+
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.
|
159
|
+
|
160
|
+
```rb
|
161
|
+
TurkishCities.list_cities({ alphabetically_sorted: true, with: { phone_code: true } })
|
162
|
+
# => [{:name=>"Adana", :phone_code=>322}, {:name=>"Adıyaman", :phone_code=>416}, {:name=>"Afyon", :phone_code=>272} .
|
163
|
+
# .. {:name=>"Yozgat", :phone_code=>354}, {:name=>"Zonguldak", :phone_code=>372}]
|
164
|
+
TurkishCities.list_cities({ with: { plate_number: true } })
|
165
|
+
# => [{:name=>"Adana", :plate_number=>1}, {:name=>"Adıyaman", :plate_number=>2}, {:name=>"Afyon", :plate_number=>3} .
|
166
|
+
# .. {:name=>"Osmaniye", :plate_number=>80}, {:name=>"Düzce", :plate_number=>81}]
|
167
|
+
TurkishCities.list_cities({ metropolitan_municipality: true, region: 'Karadeniz', with: { all: true } })
|
168
|
+
# => [{:name=>"Ordu", :plate_number=>52, :phone_code=>452, :metropolitan_municipality_since=>2012,
|
169
|
+
# :region=>"Karadeniz"},{:name=>"Samsun", :plate_number=>55, :phone_code=>362,
|
170
|
+
# :metropolitan_municipality_since=>1993, :region=>"Karadeniz"}, {:name=>"Trabzon", :plate_number=>61,
|
171
|
+
# :phone_code=>462, :metropolitan_municipality_since=>2012, :region=>"Karadeniz"}]
|
172
|
+
```
|
173
|
+
|
174
|
+
### Listing all districts of given city
|
175
|
+
|
176
|
+
City name can be given case and turkish character insensitive. Listing of districts are alphabetically sorted.
|
177
|
+
|
178
|
+
```rb
|
179
|
+
TurkishCities.list_districts('Ankara')
|
180
|
+
# => ["Akyurt", "Altındağ" ... "Sincan", "Şereflikoçhisar", "Yenimahalle"]
|
181
|
+
TurkishCities.list_districts('Eskişehir')
|
182
|
+
# => ["Alpu", "Beylikova", "Çifteler" ... "Sivrihisar", "Tepebaşı"]
|
183
|
+
TurkishCities.list_districts('Canakkale')
|
184
|
+
# => ["Ayvacık", "Bayramiç" ... "Lapseki", "Merkez", "Yenice"]
|
185
|
+
TurkishCities.list_districts('Bayburt')
|
186
|
+
# => ["Aydıntepe", "Demirözü", "Merkez"]
|
187
|
+
TurkishCities.list_districts('Istanbul').length
|
188
|
+
# => 39
|
189
|
+
TurkishCities.list_districts('filansehir')
|
190
|
+
# => "Couldn't find city name with 'filansehir'"
|
191
|
+
```
|
192
|
+
|
193
|
+
### Listing all subdistricts of given city and district
|
194
|
+
|
195
|
+
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.
|
196
|
+
|
197
|
+
```rb
|
198
|
+
TurkishCities.list_subdistricts('Adana', 'Seyhan')
|
199
|
+
# => ["Akkapı", "Denizli" ... "Yeşiloba", "Yeşilyurt", "Ziyapaşa"]
|
200
|
+
TurkishCities.list_subdistricts('Eskişehir', 'Odunpazarı')
|
201
|
+
# => ["Alanönü", "Arifiye", "Büyükdere" ... "Vişnelik", "Yenikent"]
|
202
|
+
TurkishCities.list_subdistricts('Istanbul', 'Beşiktaş')
|
203
|
+
# => ["Abbasağa", "Akatlar", "Arnavutköy", "Bebek", "Etiler", "Gayrettepe", "Levazım", "Levent", "Ortaköy", "Türkali"]
|
204
|
+
TurkishCities.list_subdistricts('filansehir', 'Beşiktaş')
|
205
|
+
# => "Couldn't find district name with 'Beşiktaş' of 'filansehir'"
|
206
|
+
TurkishCities.list_subdistricts('İstanbul', 'Kadılarköyü')
|
207
|
+
# => "Couldn't find district name with 'Kadılarköyü' of 'İstanbul'"
|
208
|
+
```
|
209
|
+
|
210
|
+
### Listing all neighborhoods of given city and district
|
211
|
+
|
212
|
+
### With subdistrict info
|
213
|
+
|
214
|
+
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.
|
215
|
+
|
216
|
+
```rb
|
217
|
+
TurkishCities.list_neighborhoods('Adana', 'Seyhan', 'Emek')
|
218
|
+
# => ["Emek Mah", "Ova Mah", "Şakirpaşa Mah", "Uçak Mah"]
|
219
|
+
TurkishCities.list_neighborhoods('Eskişehir', 'Odunpazarı', 'Büyükdere')
|
220
|
+
# => ["Büyükdere Mah", "Göztepe Mah", "Gültepe Mah", "Yıldıztepe Mah"]
|
221
|
+
TurkishCities.list_neighborhoods('Istanbul', 'Beşiktaş', 'Gayrettepe')
|
222
|
+
# => ["Balmumcu Mah", "Dikilitaş Mah", "Gayrettepe Mah", "Yıldız Mah"]
|
223
|
+
TurkishCities.list_neighborhoods('Adana', 'Beşiktaş', 'Emek')
|
224
|
+
# => "Couldn't find district name with 'Beşiktaş' of 'Adana'"
|
225
|
+
TurkishCities.list_neighborhoods('Eskişehir', 'Odunpazarı', 'Büyükkkkkdere')
|
226
|
+
# => "Couldn't find subdistrict with 'Büyükkkkkdere' of 'Odunpazarı'/'Eskişehir'"
|
227
|
+
```
|
228
|
+
|
229
|
+
### Without subdistrict info
|
230
|
+
|
231
|
+
Also ```list_neighborhoods``` can work without subdistrict information. This time neighborhoods result will be larger based on searched city and district.
|
232
|
+
|
233
|
+
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.
|
234
|
+
|
235
|
+
```rb
|
236
|
+
TurkishCities.list_neighborhoods('Adana', 'Seyhan')
|
237
|
+
# => ["2000 Evler Mah", "Ahmet Remzi Yüreğir Mah", "Akkapı Mah" ... "Zeytinli Mah", "Ziyapaşa Mah"]
|
238
|
+
TurkishCities.list_neighborhoods('Eskişehir', 'Odunpazarı')
|
239
|
+
# => ["71 Evler Mah", "75. Yıl Osb Mah" ... "Yukarıkalabak Mah", "Yürükkaracaören Mah", "Yürükkırka Mah"]
|
240
|
+
TurkishCities.list_neighborhoods('Istanbul', 'Beşiktaş')
|
241
|
+
# => ["Abbasağa Mah", "Akat Mah", "Arnavutköy Mah" ... "Türkali Mah", "Ulus Mah", "Vişnezade Mah", "Yıldız Mah"]
|
242
|
+
TurkishCities.list_neighborhoods('İstanbul', 'filanmevki')
|
243
|
+
# => "Couldn't find district name with 'filanmevki' of 'İstanbul'"
|
244
|
+
```
|
245
|
+
|
246
|
+
### Finding city, district and subdistrict name by postcode
|
247
|
+
|
248
|
+
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
|
249
|
+
|
250
|
+
```rb
|
251
|
+
TurkishCities.find_by_postcode(34380) # => ["İstanbul", "Şişli", "Cumhuriyet"]
|
252
|
+
TurkishCities.find_by_postcode(34433) # => ["İstanbul", "Beyoğlu", "Cihangir"]
|
253
|
+
TurkishCities.find_by_postcode('26040') # => ["Eskişehir", "Odunpazarı", "Büyükdere"]
|
254
|
+
TurkishCities.find_by_postcode(34382) # => "Couldn't find any subdistrict with postcode '34382'"
|
255
|
+
TurkishCities.find_by_postcode('100000') # => Given value [100000] is outside bounds of 1010 to 81952.
|
256
|
+
```
|
257
|
+
|
258
|
+
### Finding travel distance and time estimation between two cities
|
259
|
+
|
260
|
+
### By land
|
261
|
+
|
262
|
+
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.
|
263
|
+
|
264
|
+
```rb
|
265
|
+
TurkishCities.distance_between('Eskişehir', 'Kastamonu', 'land')
|
266
|
+
# => [480, "Land travel distance between Eskişehir and Kastamonu is 480 km."]
|
267
|
+
TurkishCities.distance_between('kirsehir', 'Ordu', 'land')
|
268
|
+
# => [533, "Land travel distance between Kırşehir and Ordu is 533 km."]
|
269
|
+
TurkishCities.distance_between('İzmir', 'Antalya', 'land')
|
270
|
+
# => [444, "Land travel distance between İzmir and Antalya is 444 km."]
|
271
|
+
TurkishCities.distance_between('istanbul', 'kars', 'land')
|
272
|
+
# => [1427, "Land travel distance between İstanbul and Kars is 1427 km."]
|
273
|
+
TurkishCities.distance_between('Adana', 'Adıyaman', 'time')
|
274
|
+
# => "Travel method 'time' is unsupported"
|
275
|
+
TurkishCities.distance_between('filansa', 'falansa', 'land')
|
276
|
+
# => "Couldn't find cities combination with 'filansa/falansa'"
|
277
|
+
```
|
278
|
+
|
279
|
+
### By air
|
280
|
+
|
281
|
+
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.
|
282
|
+
|
283
|
+
```rb
|
284
|
+
TurkishCities.distance_between('Eskişehir', 'Kastamonu', 'air')
|
285
|
+
# => [327.74, 62, "Air travel distance between Eskişehir and Kastamonu is 327.74 km. Estimated air travel would take 62 minutes."]
|
286
|
+
TurkishCities.distance_between('kirsehir', 'Ordu', 'air')
|
287
|
+
# => [376.89, 67, "Air travel distance between Kırşehir and Ordu is 376.89 km. Estimated air travel would take 67 minutes."]
|
288
|
+
TurkishCities.distance_between('İzmir', 'Antalya', 'air')
|
289
|
+
# => [357.18, 65, "Air travel distance between İzmir and Antalya is 357.18 km. Estimated air travel would take 65 minutes."]
|
290
|
+
TurkishCities.distance_between('istanbul', 'kars', 'air')
|
291
|
+
# => [1187.94, 120, "Air travel distance between İstanbul and Kars is 1187.94 km. Estimated air travel would take 120 minutes."]
|
292
|
+
TurkishCities.distance_between('Adana', 'Adıyaman', 'time')
|
293
|
+
# => "Travel method 'time' is unsupported"
|
294
|
+
TurkishCities.distance_between('filansa', 'falansa', 'air')
|
295
|
+
# => "Couldn't find cities combination with 'filansa/falansa'"
|
296
|
+
```
|
297
|
+
|
298
|
+
## Data sources
|
299
|
+
|
300
|
+
All information related with cities can be found at:
|
301
|
+
|
302
|
+
```
|
303
|
+
https://tr.wikipedia.org/wiki/{#city_name_here}
|
304
|
+
```
|
305
|
+
|
306
|
+
Districts, subdisctricts, neighborhoods and postcodes can be found at:
|
307
|
+
|
308
|
+
```
|
309
|
+
https://postakodu.ptt.gov.tr/
|
310
|
+
```
|
311
|
+
|
312
|
+
Land distance information can be found at:
|
313
|
+
|
314
|
+
```
|
315
|
+
https://www.kgm.gov.tr/SiteCollectionDocuments/KGMdocuments/Root/Uzakliklar/ilmesafe.xls
|
316
|
+
```
|
317
|
+
|
83
318
|
## Compatibility
|
84
319
|
|
85
|
-
|
86
|
-
|
87
|
-
|
320
|
+
| Ruby Version | Supported |
|
321
|
+
| ------------ | ------------------ |
|
322
|
+
| 2.7.1 | :white_check_mark: |
|
323
|
+
| 2.6.6 | :white_check_mark: |
|
324
|
+
| 2.5.8 | :white_check_mark: |
|
325
|
+
| < 2.5.1 | :x: |
|
326
|
+
|
327
|
+
- TurkishCities heavily depends on ```:turkic``` case mapping support of Ruby string downcase method. Below Ruby version 2.5.1 some functions will run buggy/false or even won't run at all.
|
88
328
|
|
89
|
-
|
329
|
+
## Roadmap
|
330
|
+
|
331
|
+
- Add missing sea travel method
|
332
|
+
- Add localization to gem
|
333
|
+
- Refactor tests (separate test suites with more edge case tests)
|
90
334
|
|
91
335
|
## Contributing
|
92
336
|
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
337
|
+
Contributing guidelines are available [here](CONTRIBUTING.md).
|
338
|
+
|
339
|
+
People behind the 💻
|
340
|
+
<table>
|
341
|
+
<tr>
|
342
|
+
<td align="center"><a href="https://enderahmetyurt.com/"><img src="https://avatars2.githubusercontent.com/u/447588" width="100px;" alt=""/><br /><sub><b>Ender Ahmet Yurt</b></sub></a><br /></td>
|
343
|
+
<td align="center"><a href="https://www.linkedin.com/in/serpilacar/"><img src="https://avatars0.githubusercontent.com/u/17191440" width="100px;" alt=""/><br /><sub><b>Serpil Acar</b></sub></a><br /></td>
|
344
|
+
<td align="center"><a href="https://www.linkedin.com/in/semiharslanoglu/"><img src="https://avatars2.githubusercontent.com/u/10260283" width="100px;" alt=""/><br /><sub><b>Semih Arslanoğlu</b></sub></a><br /></td>
|
345
|
+
</tr>
|
346
|
+
</table>
|
98
347
|
|
99
348
|
## Changelog
|
100
349
|
|
101
|
-
|
350
|
+
Changelog is available [here](CHANGELOG.md).
|
351
|
+
|
352
|
+
## Logo
|
353
|
+
|
354
|
+
TurkishCities's logo created by [Nebal Çolpan](https://www.behance.net/nebalcolpan). You can find the logo in various
|
355
|
+
formats [here](https://github.com/sarslanoglu/turkish_cities/tree/master/public/assets/img/).
|
356
|
+
|
357
|
+
The logo is licensed under a
|
358
|
+
[Creative Commons Attribution-NonCommercial 4.0 International License](https://creativecommons.org/licenses/by-nc/4.0/deed.en_GB).
|
102
359
|
|
103
360
|
## Copyright
|
104
361
|
|