turkish_cities 0.1.1 → 0.3.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/.gitignore +2 -0
- data/.hound.yml +3 -0
- data/.rspec +1 -0
- data/.rubocop.yml +16 -0
- data/.travis.yml +21 -0
- data/CHANGELOG.md +73 -0
- data/CODE_OF_CONDUCT.md +76 -0
- data/CONTRIBUTING.md +38 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +78 -0
- data/LICENSE.txt +7 -0
- data/README.md +338 -0
- data/lib/turkish_cities.rb +34 -2
- data/lib/turkish_cities/city.rb +58 -20
- data/lib/turkish_cities/data/cities.yaml +861 -0
- 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 +104 -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 +5 -0
- 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 +34 -0
- metadata +202 -11
- data/lib/turkish_cities/data/city_list.rb +0 -247
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d25fd4c984c9526d142458a9a5c3b6cb76b3f9d1c6b97ef97e931aca0bd305d
|
4
|
+
data.tar.gz: c8ddb6072e8db3c909d2bb023ce86a7c8f9f0b97eb655816aa8c3d4005fc30da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1543f861a161ca1384261aa85ecb058966e445db3e3c3b39cdab8df1616da101ebaebeb81f7bfd5b402cb85a3fe068c04b9d664f5fee20a8c9487d309bb9504e
|
7
|
+
data.tar.gz: d1c29d060f7205dc6312027b066f33f87364cdff050df70ca17f0d81a693cde736bfddba48cce46ceb61e3613f121bd9324875cfb6466e1e50ffc9a476f40235
|
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/.gitignore
ADDED
data/.hound.yml
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--require spec_helper
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
AllCops:
|
2
|
+
TargetRubyVersion: 2.5.1
|
3
|
+
Exclude:
|
4
|
+
- 'Gemfile'
|
5
|
+
- 'turkish_cities.gemspec'
|
6
|
+
NewCops: enable
|
7
|
+
Layout/LineLength:
|
8
|
+
Max: 120
|
9
|
+
Metrics/AbcSize:
|
10
|
+
Max: 20
|
11
|
+
Metrics/BlockLength:
|
12
|
+
ExcludedMethods: ['describe', 'context']
|
13
|
+
Metrics/MethodLength:
|
14
|
+
Max: 15
|
15
|
+
Style/Documentation:
|
16
|
+
Enabled: false
|
data/.travis.yml
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
env:
|
2
|
+
global:
|
3
|
+
- CC_TEST_REPORTER_ID=23062197f289fd0ae7601ae06c2dd4a0af4e16c436f2428b99ab4b64a7e4a587
|
4
|
+
language: ruby
|
5
|
+
dist: trusty
|
6
|
+
rvm:
|
7
|
+
- 2.5
|
8
|
+
- 2.6
|
9
|
+
- 2.7
|
10
|
+
before_install:
|
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
|
16
|
+
script: bundle exec rspec spec
|
17
|
+
after_script:
|
18
|
+
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|
19
|
+
notifications:
|
20
|
+
email:
|
21
|
+
- arslanoglusemih93@gmail.com
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
## 0.3.0 (2020-11-22)
|
4
|
+
|
5
|
+
### New features
|
6
|
+
|
7
|
+
* [#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
|
8
|
+
|
9
|
+
### Changes
|
10
|
+
|
11
|
+
* [#50](https://github.com/sarslanoglu/turkish_cities/issues/50): Additional improvements on `District` class methods
|
12
|
+
|
13
|
+
* [#45](https://github.com/sarslanoglu/turkish_cities/issues/45): Refactor `District` class
|
14
|
+
|
15
|
+
## 0.2.1 (2020-06-29)
|
16
|
+
|
17
|
+
### Bug fixes
|
18
|
+
|
19
|
+
* [#38](https://github.com/sarslanoglu/turkish_cities/issues/38): ```NoMethodError``` on ```list_neighborhoods``` when called with wrong subdistrict name
|
20
|
+
|
21
|
+
### Changes
|
22
|
+
|
23
|
+
* [#39](https://github.com/sarslanoglu/turkish_cities/issues/39): May maintenance of gem - 2020-05-24
|
24
|
+
|
25
|
+
## 0.2.0 (2020-05-18)
|
26
|
+
|
27
|
+
### New features
|
28
|
+
|
29
|
+
* [#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
|
30
|
+
|
31
|
+
* [#33](https://github.com/sarslanoglu/turkish_cities/issues/33): Add ```list_neighborhoods``` method for listing neighborhoods and fix some wrong district names
|
32
|
+
|
33
|
+
* [#29](https://github.com/sarslanoglu/turkish_cities/issues/29): Add ```district``` class and ```list_subdistricts``` method for listing subdistricts
|
34
|
+
|
35
|
+
* [#27](https://github.com/sarslanoglu/turkish_cities/issues/27): Add all subdistricts and neighborhoods of all Turkish cities
|
36
|
+
|
37
|
+
* [#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
|
38
|
+
|
39
|
+
### Changes
|
40
|
+
|
41
|
+
* [#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
|
42
|
+
|
43
|
+
## 0.1.3 (2020-04-20)
|
44
|
+
|
45
|
+
### New features
|
46
|
+
|
47
|
+
* [#22](https://github.com/sarslanoglu/turkish_cities/issues/22): Add region data to cities.yaml and update ```list_cities``` method to support regions
|
48
|
+
|
49
|
+
* [#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
|
50
|
+
|
51
|
+
### Bug fixes
|
52
|
+
|
53
|
+
* [#18](https://github.com/sarslanoglu/turkish_cities/issues/18): Fix yaml file read error while deploying apps to Heroku
|
54
|
+
|
55
|
+
## 0.1.2 (2020-04-13)
|
56
|
+
|
57
|
+
### New features
|
58
|
+
|
59
|
+
* [#3](https://github.com/sarslanoglu/turkish_cities/issues/3): Change city_list data to yaml file format
|
60
|
+
|
61
|
+
### Bug fixes
|
62
|
+
|
63
|
+
* [#2](https://github.com/sarslanoglu/turkish_cities/issues/2): Fix capital Turkish characters bug on cities with capital 'I' letter
|
64
|
+
|
65
|
+
### Changes
|
66
|
+
|
67
|
+
* [#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
|
68
|
+
|
69
|
+
## 0.1.1 (2020-03-31)
|
70
|
+
|
71
|
+
### Changes
|
72
|
+
|
73
|
+
* Fix homepage problem on .gemspec file
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, sex characteristics, gender identity and expression,
|
9
|
+
level of experience, education, socio-economic status, nationality, personal
|
10
|
+
appearance, race, religion, or sexual identity and orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at arslanoglusemih93@gmail.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
72
|
+
|
73
|
+
[homepage]: https://www.contributor-covenant.org
|
74
|
+
|
75
|
+
For answers to common questions about this code of conduct, see
|
76
|
+
https://www.contributor-covenant.org/faq
|
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
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
turkish_cities (0.3.0)
|
5
|
+
i18n (>= 0.6.4, <= 2)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
ast (2.4.1)
|
11
|
+
concurrent-ruby (1.1.6)
|
12
|
+
coveralls (0.8.23)
|
13
|
+
json (>= 1.8, < 3)
|
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)
|
20
|
+
i18n (1.8.5)
|
21
|
+
concurrent-ruby (~> 1.0)
|
22
|
+
json (2.3.0)
|
23
|
+
parallel (1.20.0)
|
24
|
+
parser (2.7.2.0)
|
25
|
+
ast (~> 2.4.1)
|
26
|
+
rainbow (3.0.0)
|
27
|
+
regexp_parser (1.8.2)
|
28
|
+
rexml (3.2.4)
|
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
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
37
|
+
rspec-support (~> 3.10.0)
|
38
|
+
rspec-mocks (3.10.0)
|
39
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
40
|
+
rspec-support (~> 3.10.0)
|
41
|
+
rspec-support (3.10.0)
|
42
|
+
rubocop (1.3.1)
|
43
|
+
parallel (~> 1.10)
|
44
|
+
parser (>= 2.7.1.5)
|
45
|
+
rainbow (>= 2.2.2, < 4.0)
|
46
|
+
regexp_parser (>= 1.8)
|
47
|
+
rexml
|
48
|
+
rubocop-ast (>= 1.1.1)
|
49
|
+
ruby-progressbar (~> 1.7)
|
50
|
+
unicode-display_width (>= 1.4.0, < 2.0)
|
51
|
+
rubocop-ast (1.1.1)
|
52
|
+
parser (>= 2.7.1.5)
|
53
|
+
ruby-progressbar (1.10.1)
|
54
|
+
simplecov (0.16.1)
|
55
|
+
docile (~> 1.1)
|
56
|
+
json (>= 1.8, < 3)
|
57
|
+
simplecov-html (~> 0.10.0)
|
58
|
+
simplecov-html (0.10.2)
|
59
|
+
sync (0.5.0)
|
60
|
+
term-ansicolor (1.7.1)
|
61
|
+
tins (~> 1.0)
|
62
|
+
thor (1.0.1)
|
63
|
+
tins (1.25.0)
|
64
|
+
sync
|
65
|
+
unicode-display_width (1.7.0)
|
66
|
+
|
67
|
+
PLATFORMS
|
68
|
+
ruby
|
69
|
+
|
70
|
+
DEPENDENCIES
|
71
|
+
bundler (~> 2.1.4)
|
72
|
+
coveralls (~> 0.8.23)
|
73
|
+
rspec (~> 3.10.0)
|
74
|
+
rubocop (~> 1.3.1)
|
75
|
+
turkish_cities!
|
76
|
+
|
77
|
+
BUNDLED WITH
|
78
|
+
2.1.4
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
Copyright (c) 2020 Semih Arslanoglu
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
4
|
+
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
6
|
+
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,338 @@
|
|
1
|
+
# ![TurkishCities](./public/assets/img/TurkishCities_yellow-on-darkblue_horizontal_914X343@3x-8.png)
|
2
|
+
|
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 air](#by-air)
|
39
|
+
* [Data sources](#data-sources)
|
40
|
+
* [Compatibility](#compatibility)
|
41
|
+
* [Contributing](#contributing)
|
42
|
+
* [Changelog](#changelog)
|
43
|
+
* [Copyright](#copyright)
|
44
|
+
|
45
|
+
## Installation
|
46
|
+
|
47
|
+
Installation is pretty standard:
|
48
|
+
|
49
|
+
```sh
|
50
|
+
$ gem install turkish_cities
|
51
|
+
```
|
52
|
+
|
53
|
+
or with using Bundler, add this line to your Gemfile
|
54
|
+
|
55
|
+
```rb
|
56
|
+
gem 'turkish_cities'
|
57
|
+
```
|
58
|
+
|
59
|
+
and run
|
60
|
+
|
61
|
+
```sh
|
62
|
+
$ bundle
|
63
|
+
```
|
64
|
+
|
65
|
+
## Documentation
|
66
|
+
|
67
|
+
With using irb just require gem and start using
|
68
|
+
|
69
|
+
```rb
|
70
|
+
require 'turkish_cities'
|
71
|
+
```
|
72
|
+
|
73
|
+
### Finding city name by plate number
|
74
|
+
|
75
|
+
There are 81 cities in Turkey. By calling a plate number between 1-81 will give city_name.
|
76
|
+
|
77
|
+
```rb
|
78
|
+
TurkishCities.find_name_by_plate_number(26) # => "Eskişehir"
|
79
|
+
TurkishCities.find_name_by_plate_number(7) # => "Antalya"
|
80
|
+
TurkishCities.find_name_by_plate_number(0007) # => "Antalya"
|
81
|
+
TurkishCities.find_name_by_plate_number(43.0) # => "Kütahya"
|
82
|
+
TurkishCities.find_name_by_plate_number('78') # => "Karabük"
|
83
|
+
TurkishCities.find_name_by_plate_number(100) # => 'Given value [100] is outside bounds of 1 to 81.'
|
84
|
+
```
|
85
|
+
|
86
|
+
### Finding city name by phone code
|
87
|
+
|
88
|
+
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.
|
89
|
+
|
90
|
+
```rb
|
91
|
+
TurkishCities.find_name_by_phone_code(312) # => "Ankara"
|
92
|
+
TurkishCities.find_name_by_phone_code(242) # => "Antalya"
|
93
|
+
TurkishCities.find_name_by_phone_code(000222) # => "Eskişehir"
|
94
|
+
TurkishCities.find_name_by_phone_code(274.0) # => "Kütahya"
|
95
|
+
TurkishCities.find_name_by_phone_code('212') # => "İstanbul"
|
96
|
+
TurkishCities.find_name_by_phone_code(216) # => "İstanbul"
|
97
|
+
TurkishCities.find_name_by_phone_code(360) # => 'Couldn't find city name with phone code 360'
|
98
|
+
TurkishCities.find_name_by_phone_code(0) # => 'Given value [0] is outside bounds of 212 to 488.'
|
99
|
+
TurkishCities.find_name_by_phone_code(213) # => 'Given value [213] must be an even number.'
|
100
|
+
```
|
101
|
+
|
102
|
+
### Finding plate number by city name
|
103
|
+
|
104
|
+
City name can be given case and turkish character insensitive.
|
105
|
+
|
106
|
+
```rb
|
107
|
+
TurkishCities.find_plate_number_by_name('Ankara') # => 6
|
108
|
+
TurkishCities.find_plate_number_by_name('Eskişehir') # => 26
|
109
|
+
TurkishCities.find_plate_number_by_name('Canakkale') # => 17
|
110
|
+
TurkishCities.find_plate_number_by_name('Istanbul') # => 34
|
111
|
+
TurkishCities.find_plate_number_by_name('kirsehir') # => 40
|
112
|
+
TurkishCities.find_plate_number_by_name('falansehir') # => "Couldn't find city name with 'falansehir'"
|
113
|
+
```
|
114
|
+
|
115
|
+
### Finding phone code by city name
|
116
|
+
|
117
|
+
City name can be given case and turkish character insensitive.
|
118
|
+
|
119
|
+
```rb
|
120
|
+
TurkishCities.find_phone_code_by_name('Ankara') # => 312
|
121
|
+
TurkishCities.find_phone_code_by_name('Eskişehir') # => 222
|
122
|
+
TurkishCities.find_phone_code_by_name('Canakkale') # => 286
|
123
|
+
TurkishCities.find_phone_code_by_name('Istanbul') # => [212, 216]
|
124
|
+
TurkishCities.find_phone_code_by_name('kirsehir') # => 386
|
125
|
+
TurkishCities.find_phone_code_by_name('filansehir') # => "Couldn't find city name with 'filansehir'"
|
126
|
+
```
|
127
|
+
|
128
|
+
### Listing all cities
|
129
|
+
|
130
|
+
By default cities will be listed by their plate number ascending.
|
131
|
+
|
132
|
+
```rb
|
133
|
+
TurkishCities.list_cities # => ["Adana", "Adıyaman" ... "Kilis", "Osmaniye", "Düzce"]
|
134
|
+
```
|
135
|
+
|
136
|
+
### Listing all cities with only name
|
137
|
+
|
138
|
+
While listing cities three additional parameters can be send ```alphabetically_sorted```, ```metropolitan_municipality``` and ```region```. All parameters can be send seperately and together.
|
139
|
+
|
140
|
+
```rb
|
141
|
+
TurkishCities.list_cities({ alphabetically_sorted: true })
|
142
|
+
# => ["Adana", "Adıyaman" ... "Yalova", "Yozgat", "Zonguldak"]
|
143
|
+
TurkishCities.list_cities({ metropolitan_municipality: true })
|
144
|
+
# => ["Adana", "Ankara" ... "Trabzon", "Şanlıurfa", "Van"]
|
145
|
+
TurkishCities.list_cities({ region: 'Karadeniz' })
|
146
|
+
# => ["Amasya", "Artvin" ... "Bartın", "Karabük", "Düzce"]
|
147
|
+
TurkishCities.list_cities({ alphabetically_sorted: true, region: 'Karadeniz' })
|
148
|
+
# => ["Amasya", "Artvin" ... "Tokat", "Trabzon", "Zonguldak"]
|
149
|
+
TurkishCities.list_cities({ metropolitan_municipality: true, region: 'Karadeniz' })
|
150
|
+
# => ["Ordu", "Samsun", "Trabzon"]
|
151
|
+
TurkishCities.list_cities({ alphabetically_sorted: true, metropolitan_municipality: true })
|
152
|
+
# => ["Adana", "Ankara" ... "Tekirdağ", "Trabzon", "Van"]
|
153
|
+
```
|
154
|
+
|
155
|
+
### Listing all cities with other parameters
|
156
|
+
|
157
|
+
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 send seperately and together.
|
158
|
+
|
159
|
+
```rb
|
160
|
+
TurkishCities.list_cities({ alphabetically_sorted: true, with: { phone_code: true } })
|
161
|
+
# => [{:name=>"Adana", :phone_code=>322}, {:name=>"Adıyaman", :phone_code=>416}, {:name=>"Afyon", :phone_code=>272} .
|
162
|
+
# .. {:name=>"Yozgat", :phone_code=>354}, {:name=>"Zonguldak", :phone_code=>372}]
|
163
|
+
TurkishCities.list_cities({ with: { plate_number: true } })
|
164
|
+
# => [{:name=>"Adana", :plate_number=>1}, {:name=>"Adıyaman", :plate_number=>2}, {:name=>"Afyon", :plate_number=>3} .
|
165
|
+
# .. {:name=>"Osmaniye", :plate_number=>80}, {:name=>"Düzce", :plate_number=>81}]
|
166
|
+
TurkishCities.list_cities({ metropolitan_municipality: true, region: 'Karadeniz', with: { all: true } })
|
167
|
+
# => [{:name=>"Ordu", :plate_number=>52, :phone_code=>452, :metropolitan_municipality_since=>2012,
|
168
|
+
# :region=>"Karadeniz"},{:name=>"Samsun", :plate_number=>55, :phone_code=>362,
|
169
|
+
# :metropolitan_municipality_since=>1993, :region=>"Karadeniz"}, {:name=>"Trabzon", :plate_number=>61,
|
170
|
+
# :phone_code=>462, :metropolitan_municipality_since=>2012, :region=>"Karadeniz"}]
|
171
|
+
```
|
172
|
+
|
173
|
+
### Listing all districts of given city
|
174
|
+
|
175
|
+
City name can be given case and turkish character insensitive. Listing of districts are alphabetically sorted.
|
176
|
+
|
177
|
+
```rb
|
178
|
+
TurkishCities.list_districts('Ankara')
|
179
|
+
# => ["Akyurt", "Altındağ" ... "Sincan", "Şereflikoçhisar", "Yenimahalle"]
|
180
|
+
TurkishCities.list_districts('Eskişehir')
|
181
|
+
# => ["Alpu", "Beylikova", "Çifteler" ... "Sivrihisar", "Tepebaşı"]
|
182
|
+
TurkishCities.list_districts('Canakkale')
|
183
|
+
# => ["Ayvacık", "Bayramiç" ... "Lapseki", "Merkez", "Yenice"]
|
184
|
+
TurkishCities.list_districts('Bayburt')
|
185
|
+
# => ["Aydıntepe", "Demirözü", "Merkez"]
|
186
|
+
TurkishCities.list_districts('Istanbul').length
|
187
|
+
# => 39
|
188
|
+
TurkishCities.list_districts('filansehir')
|
189
|
+
# => "Couldn't find city name with 'filansehir'"
|
190
|
+
```
|
191
|
+
|
192
|
+
### Listing all subdistricts of given city and district
|
193
|
+
|
194
|
+
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.
|
195
|
+
|
196
|
+
```rb
|
197
|
+
TurkishCities.list_subdistricts('Adana', 'Seyhan')
|
198
|
+
# => ["Akkapı", "Denizli" ... "Yeşiloba", "Yeşilyurt", "Ziyapaşa"]
|
199
|
+
TurkishCities.list_subdistricts('Eskişehir', 'Odunpazarı')
|
200
|
+
# => ["Alanönü", "Arifiye", "Büyükdere" ... "Vişnelik", "Yenikent"]
|
201
|
+
TurkishCities.list_subdistricts('Istanbul', 'Beşiktaş')
|
202
|
+
# => ["Abbasağa", "Akatlar", "Arnavutköy", "Bebek", "Etiler", "Gayrettepe", "Levazım", "Levent", "Ortaköy", "Türkali"]
|
203
|
+
TurkishCities.list_subdistricts('filansehir', 'Beşiktaş')
|
204
|
+
# => "Couldn't find district name with 'Beşiktaş' of 'filansehir'"
|
205
|
+
TurkishCities.list_subdistricts('İstanbul', 'Kadılarköyü')
|
206
|
+
# => "Couldn't find district name with 'Kadılarköyü' of 'İstanbul'"
|
207
|
+
```
|
208
|
+
|
209
|
+
### Listing all neighborhoods of given city and district
|
210
|
+
|
211
|
+
### With subdistrict info
|
212
|
+
|
213
|
+
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 ```list_districts``` method. Correct subdistrict names can be obtained by ```list_subdistricts``` method.) Listing of neighborhoods are alphabetically sorted.
|
214
|
+
|
215
|
+
```rb
|
216
|
+
TurkishCities.list_neighborhoods('Adana', 'Seyhan', 'Emek')
|
217
|
+
# => ["Emek Mah", "Ova Mah", "Şakirpaşa Mah", "Uçak Mah"]
|
218
|
+
TurkishCities.list_neighborhoods('Eskişehir', 'Odunpazarı', 'Büyükdere')
|
219
|
+
# => ["Büyükdere Mah", "Göztepe Mah", "Gültepe Mah", "Yıldıztepe Mah"]
|
220
|
+
TurkishCities.list_neighborhoods('Istanbul', 'Beşiktaş', 'Gayrettepe')
|
221
|
+
# => ["Balmumcu Mah", "Dikilitaş Mah", "Gayrettepe Mah", "Yıldız Mah"]
|
222
|
+
TurkishCities.list_neighborhoods('Adana', 'Beşiktaş', 'Emek')
|
223
|
+
# => "Couldn't find district name with 'Beşiktaş' of 'Adana'"
|
224
|
+
TurkishCities.list_neighborhoods('Eskişehir', 'Odunpazarı', 'Büyükkkkkdere')
|
225
|
+
# => "Couldn't find subdistrict with 'Büyükkkkkdere' of 'Odunpazarı'/'Eskişehir'"
|
226
|
+
```
|
227
|
+
|
228
|
+
### Without subdistrict info
|
229
|
+
|
230
|
+
Also ```list_neighborhoods``` can work without subdistrict information. This time neighborhoods result will be larger based on searched city and district.
|
231
|
+
|
232
|
+
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 neighborhoods are alphabetically sorted.
|
233
|
+
|
234
|
+
```rb
|
235
|
+
TurkishCities.list_neighborhoods('Adana', 'Seyhan')
|
236
|
+
# => ["2000 Evler Mah", "Ahmet Remzi Yüreğir Mah", "Akkapı Mah" ... "Zeytinli Mah", "Ziyapaşa Mah"]
|
237
|
+
TurkishCities.list_neighborhoods('Eskişehir', 'Odunpazarı')
|
238
|
+
# => ["71 Evler Mah", "75. Yıl Osb Mah" ... "Yukarıkalabak Mah", "Yürükkaracaören Mah", "Yürükkırka Mah"]
|
239
|
+
TurkishCities.list_neighborhoods('Istanbul', 'Beşiktaş')
|
240
|
+
# => ["Abbasağa Mah", "Akat Mah", "Arnavutköy Mah" ... "Türkali Mah", "Ulus Mah", "Vişnezade Mah", "Yıldız Mah"]
|
241
|
+
TurkishCities.list_neighborhoods('İstanbul', 'filanmevki')
|
242
|
+
# => "Couldn't find district name with 'filanmevki' of 'İstanbul'"
|
243
|
+
```
|
244
|
+
|
245
|
+
### Finding city, district and subdistrict name by postcode
|
246
|
+
|
247
|
+
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
|
248
|
+
|
249
|
+
```rb
|
250
|
+
TurkishCities.find_by_postcode(34380) # => ["İstanbul", "Şişli", "Cumhuriyet"]
|
251
|
+
TurkishCities.find_by_postcode(34433) # => ["İstanbul", "Beyoğlu", "Cihangir"]
|
252
|
+
TurkishCities.find_by_postcode('26040') # => ["Eskişehir", "Odunpazarı", "Büyükdere"]
|
253
|
+
TurkishCities.find_by_postcode(34382) # => "Couldn't find any subdistrict with postcode '34382'"
|
254
|
+
TurkishCities.find_by_postcode('100000') # => Given value [100000] is outside bounds of 1010 to 81952.
|
255
|
+
```
|
256
|
+
|
257
|
+
### Finding travel distance and time estimation between two cities
|
258
|
+
|
259
|
+
### By air
|
260
|
+
|
261
|
+
City names can be given case and turkish character insensitive. Travel method should be lower case. Array with 3 elements will be return. First element is distance between cities in kilometers, second element is estimated travel time and last element is description created by first two element.
|
262
|
+
|
263
|
+
```rb
|
264
|
+
TurkishCities.distance_between('Eskişehir', 'Kastamonu', 'air')
|
265
|
+
# => [327.74, 62, "Air travel distance between Eskişehir and Kastamonu is 327.74 km. Estimated air travel would take 62 minutes."]
|
266
|
+
TurkishCities.distance_between('kirsehir', 'Ordu', 'air')
|
267
|
+
# => [376.89, 67, "Air travel distance between Kırşehir and Ordu is 376.89 km. Estimated air travel would take 67 minutes."]
|
268
|
+
TurkishCities.distance_between('İzmir', 'Antalya', 'air')
|
269
|
+
# => [357.18, 65, "Air travel distance between İzmir and Antalya is 357.18 km. Estimated air travel would take 65 minutes."]
|
270
|
+
TurkishCities.distance_between('istanbul', 'kars', 'air')
|
271
|
+
# => [1187.94, 120, "Air travel distance between İstanbul and Kars is 1187.94 km. Estimated air travel would take 120 minutes."]
|
272
|
+
TurkishCities.distance_between('Adana', 'Adıyaman', 'time')
|
273
|
+
# => "Travel method 'time' is unsupported"
|
274
|
+
TurkishCities.distance_between('filansa', 'falansa', 'air')
|
275
|
+
# => "Couldn't find cities combination with 'filansa/falansa'"
|
276
|
+
```
|
277
|
+
|
278
|
+
## Data sources
|
279
|
+
|
280
|
+
All information related with cities can be found at:
|
281
|
+
|
282
|
+
```
|
283
|
+
https://tr.wikipedia.org/wiki/{#city_name_here}
|
284
|
+
```
|
285
|
+
|
286
|
+
Districts, subdisctricts, neighborhoods and postcodes can be found at:
|
287
|
+
|
288
|
+
```
|
289
|
+
https://postakodu.ptt.gov.tr/
|
290
|
+
```
|
291
|
+
|
292
|
+
## Compatibility
|
293
|
+
|
294
|
+
| Ruby Version | Supported |
|
295
|
+
| ------------ | ------------------ |
|
296
|
+
| 2.7.1 | :white_check_mark: |
|
297
|
+
| 2.6.6 | :white_check_mark: |
|
298
|
+
| 2.5.8 | :white_check_mark: |
|
299
|
+
| < 2.5.1 | :x: |
|
300
|
+
|
301
|
+
- 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.
|
302
|
+
|
303
|
+
## Roadmap
|
304
|
+
|
305
|
+
- Add missing land travel method
|
306
|
+
- Add missing sea travel method
|
307
|
+
- Add localization to gem
|
308
|
+
- Refactor tests (seperate test suites with more edge case tests)
|
309
|
+
|
310
|
+
## Contributing
|
311
|
+
|
312
|
+
Contributing guidelines are available [here](CONTRIBUTING.md).
|
313
|
+
|
314
|
+
People behind the 💻
|
315
|
+
<table>
|
316
|
+
<tr>
|
317
|
+
<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>
|
318
|
+
<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>
|
319
|
+
<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>
|
320
|
+
</tr>
|
321
|
+
</table>
|
322
|
+
|
323
|
+
## Changelog
|
324
|
+
|
325
|
+
Changelog is available [here](CHANGELOG.md).
|
326
|
+
|
327
|
+
## Logo
|
328
|
+
|
329
|
+
TurkishCities's logo created by [Nebal Çolpan](https://www.behance.net/nebalcolpan). You can find the logo in various
|
330
|
+
formats [here](https://github.com/sarslanoglu/turkish_cities/tree/master/public/assets/img/).
|
331
|
+
|
332
|
+
The logo is licensed under a
|
333
|
+
[Creative Commons Attribution-NonCommercial 4.0 International License](https://creativecommons.org/licenses/by-nc/4.0/deed.en_GB).
|
334
|
+
|
335
|
+
## Copyright
|
336
|
+
|
337
|
+
Copyright (c) 2020 Semih Arslanoglu. See [LICENSE.txt](LICENSE.txt) for
|
338
|
+
further details.
|