turkish_cities 0.1.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. checksums.yaml +4 -4
  2. data/.codeclimate.yml +5 -0
  3. data/.github/ISSUE_TEMPLATE/bug_report.md +22 -0
  4. data/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
  5. data/.github/pull_request_template.md +38 -0
  6. data/.gitignore +2 -0
  7. data/.hound.yml +3 -0
  8. data/.rspec +1 -0
  9. data/.rubocop.yml +16 -0
  10. data/.travis.yml +21 -0
  11. data/CHANGELOG.md +61 -0
  12. data/CODE_OF_CONDUCT.md +76 -0
  13. data/CONTRIBUTING.md +38 -0
  14. data/Gemfile +3 -0
  15. data/Gemfile.lock +78 -0
  16. data/LICENSE.txt +7 -0
  17. data/README.md +267 -0
  18. data/lib/turkish_cities.rb +29 -2
  19. data/lib/turkish_cities/city.rb +57 -20
  20. data/lib/turkish_cities/data/cities.yaml +619 -0
  21. data/lib/turkish_cities/data/districts/adana.yaml +1043 -0
  22. data/lib/turkish_cities/data/districts/adiyaman.yaml +1243 -0
  23. data/lib/turkish_cities/data/districts/afyon.yaml +1253 -0
  24. data/lib/turkish_cities/data/districts/agri.yaml +1038 -0
  25. data/lib/turkish_cities/data/districts/aksaray.yaml +491 -0
  26. data/lib/turkish_cities/data/districts/amasya.yaml +753 -0
  27. data/lib/turkish_cities/data/districts/ankara.yaml +1712 -0
  28. data/lib/turkish_cities/data/districts/antalya.yaml +1114 -0
  29. data/lib/turkish_cities/data/districts/ardahan.yaml +396 -0
  30. data/lib/turkish_cities/data/districts/artvin.yaml +1956 -0
  31. data/lib/turkish_cities/data/districts/aydin.yaml +761 -0
  32. data/lib/turkish_cities/data/districts/balikesir.yaml +1338 -0
  33. data/lib/turkish_cities/data/districts/bartin.yaml +1065 -0
  34. data/lib/turkish_cities/data/districts/batman.yaml +790 -0
  35. data/lib/turkish_cities/data/districts/bayburt.yaml +263 -0
  36. data/lib/turkish_cities/data/districts/bilecik.yaml +425 -0
  37. data/lib/turkish_cities/data/districts/bingol.yaml +1159 -0
  38. data/lib/turkish_cities/data/districts/bitlis.yaml +818 -0
  39. data/lib/turkish_cities/data/districts/bolu.yaml +1730 -0
  40. data/lib/turkish_cities/data/districts/burdur.yaml +592 -0
  41. data/lib/turkish_cities/data/districts/bursa.yaml +1266 -0
  42. data/lib/turkish_cities/data/districts/canakkale.yaml +1035 -0
  43. data/lib/turkish_cities/data/districts/cankiri.yaml +719 -0
  44. data/lib/turkish_cities/data/districts/corum.yaml +1576 -0
  45. data/lib/turkish_cities/data/districts/denizli.yaml +724 -0
  46. data/lib/turkish_cities/data/districts/diyarbakir.yaml +1132 -0
  47. data/lib/turkish_cities/data/districts/duzce.yaml +756 -0
  48. data/lib/turkish_cities/data/districts/edirne.yaml +457 -0
  49. data/lib/turkish_cities/data/districts/elazig.yaml +1560 -0
  50. data/lib/turkish_cities/data/districts/erzincan.yaml +1086 -0
  51. data/lib/turkish_cities/data/districts/erzurum.yaml +1278 -0
  52. data/lib/turkish_cities/data/districts/eskisehir.yaml +673 -0
  53. data/lib/turkish_cities/data/districts/gaziantep.yaml +872 -0
  54. data/lib/turkish_cities/data/districts/giresun.yaml +2753 -0
  55. data/lib/turkish_cities/data/districts/gumushane.yaml +1185 -0
  56. data/lib/turkish_cities/data/districts/hakkari.yaml +478 -0
  57. data/lib/turkish_cities/data/districts/hatay.yaml +680 -0
  58. data/lib/turkish_cities/data/districts/igdir.yaml +272 -0
  59. data/lib/turkish_cities/data/districts/isparta.yaml +676 -0
  60. data/lib/turkish_cities/data/districts/istanbul.yaml +1812 -0
  61. data/lib/turkish_cities/data/districts/izmir.yaml +1657 -0
  62. data/lib/turkish_cities/data/districts/kahramanmaras.yaml +776 -0
  63. data/lib/turkish_cities/data/districts/karabuk.yaml +1171 -0
  64. data/lib/turkish_cities/data/districts/karaman.yaml +477 -0
  65. data/lib/turkish_cities/data/districts/kars.yaml +572 -0
  66. data/lib/turkish_cities/data/districts/kastamonu.yaml +4485 -0
  67. data/lib/turkish_cities/data/districts/kayseri.yaml +852 -0
  68. data/lib/turkish_cities/data/districts/kilis.yaml +328 -0
  69. data/lib/turkish_cities/data/districts/kirikkale.yaml +423 -0
  70. data/lib/turkish_cities/data/districts/kirklareli.yaml +384 -0
  71. data/lib/turkish_cities/data/districts/kirsehir.yaml +475 -0
  72. data/lib/turkish_cities/data/districts/kocaeli.yaml +597 -0
  73. data/lib/turkish_cities/data/districts/konya.yaml +1418 -0
  74. data/lib/turkish_cities/data/districts/kutahya.yaml +1042 -0
  75. data/lib/turkish_cities/data/districts/malatya.yaml +828 -0
  76. data/lib/turkish_cities/data/districts/manisa.yaml +1318 -0
  77. data/lib/turkish_cities/data/districts/mardin.yaml +762 -0
  78. data/lib/turkish_cities/data/districts/mersin.yaml +1013 -0
  79. data/lib/turkish_cities/data/districts/mugla.yaml +622 -0
  80. data/lib/turkish_cities/data/districts/mus.yaml +749 -0
  81. data/lib/turkish_cities/data/districts/nevsehir.yaml +481 -0
  82. data/lib/turkish_cities/data/districts/nigde.yaml +437 -0
  83. data/lib/turkish_cities/data/districts/ordu.yaml +857 -0
  84. data/lib/turkish_cities/data/districts/osmaniye.yaml +655 -0
  85. data/lib/turkish_cities/data/districts/rize.yaml +1447 -0
  86. data/lib/turkish_cities/data/districts/sakarya.yaml +744 -0
  87. data/lib/turkish_cities/data/districts/samsun.yaml +1363 -0
  88. data/lib/turkish_cities/data/districts/sanliurfa.yaml +1505 -0
  89. data/lib/turkish_cities/data/districts/siirt.yaml +579 -0
  90. data/lib/turkish_cities/data/districts/sinop.yaml +2061 -0
  91. data/lib/turkish_cities/data/districts/sirnak.yaml +404 -0
  92. data/lib/turkish_cities/data/districts/sivas.yaml +2476 -0
  93. data/lib/turkish_cities/data/districts/tekirdag.yaml +436 -0
  94. data/lib/turkish_cities/data/districts/tokat.yaml +1553 -0
  95. data/lib/turkish_cities/data/districts/trabzon.yaml +794 -0
  96. data/lib/turkish_cities/data/districts/tunceli.yaml +1074 -0
  97. data/lib/turkish_cities/data/districts/usak.yaml +735 -0
  98. data/lib/turkish_cities/data/districts/van.yaml +754 -0
  99. data/lib/turkish_cities/data/districts/yalova.yaml +151 -0
  100. data/lib/turkish_cities/data/districts/yozgat.yaml +939 -0
  101. data/lib/turkish_cities/data/districts/zonguldak.yaml +1599 -0
  102. data/lib/turkish_cities/data/neighborhoods_parser.rb +52 -0
  103. data/lib/turkish_cities/district.rb +69 -0
  104. data/lib/turkish_cities/helpers/decomposer_helper.rb +96 -0
  105. data/lib/turkish_cities/postcode.rb +27 -0
  106. data/lib/turkish_cities/version.rb +5 -0
  107. data/turkish_cities.gemspec +34 -0
  108. metadata +192 -9
  109. 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: d0cd05d34a416272e2b661c675e262f27737396cf43cad8a73ecc87d21c19fcb
4
- data.tar.gz: ebfffaf7f5e7a1790b6300ea1f377c35aac9b1792d571315379ecd954ccaff0e
3
+ metadata.gz: cf40e5e9b493d00931c7cda7597941d09a589f18eacaace649659bbc3018324e
4
+ data.tar.gz: 25776268893ae75242c27025bfc581bb50a6aa77154fef88c4bd584434456e8b
5
5
  SHA512:
6
- metadata.gz: 66047b377afdd925f20c54e8a17e40b3985b4919f2010e8dd82f59bf59a22a1afb5612b6487085503f21ebfb18cd11692c9ca5e89563e65a1df4c93e81e8af12
7
- data.tar.gz: 3c46b9903d71b2325219f8fb7f3339df600e5a0a7d1d8abd8295ee70d031760b489b1353bcaaddef3ae4705a8523589c5520bb858f12c461cefefcd4be7657c7
6
+ metadata.gz: 7d69c0c456c33731de3b9c02a63a90f18893d761c6fad0cf688fb0af350e9263411ef4f15fe5588732048b9d351491c80cbe023376ecf747fa80631fede07ddf
7
+ data.tar.gz: f4d429988cfc994842db241e3ae0e5440de8a6c8be09d691bdd5037492d73f95c7d347b9bb4c6a088e546c5e6b3083ef80dbe1dea7f81fb34a913410300556e4
@@ -0,0 +1,5 @@
1
+ version: "2"
2
+ checks:
3
+ method-complexity:
4
+ config:
5
+ threshold: 10
@@ -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. -->
@@ -0,0 +1,2 @@
1
+ # Simplecov related files
2
+ /coverage
@@ -0,0 +1,3 @@
1
+ rubocop:
2
+ version: 0.83.0
3
+ config_file: .rubocop.yml
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --require spec_helper
@@ -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: 100
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
@@ -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
@@ -0,0 +1,61 @@
1
+ # Changelog
2
+
3
+ ## 0.2.1 (2020-06-29)
4
+
5
+ ### Bug fixes
6
+
7
+ * [#38](https://github.com/sarslanoglu/turkish_cities/issues/38): ```NoMethodError``` on ```list_neighborhoods``` when called with wrong subdistrict name
8
+
9
+ ### Changes
10
+
11
+ * [#39](https://github.com/sarslanoglu/turkish_cities/issues/39): May maintenance of gem - 2020-05-24
12
+
13
+ ## 0.2.0 (2020-05-18)
14
+
15
+ ### New features
16
+
17
+ * [#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
18
+
19
+ * [#33](https://github.com/sarslanoglu/turkish_cities/issues/33): Add ```list_neighborhoods``` method for listing neighborhoods and fix some wrong district names
20
+
21
+ * [#29](https://github.com/sarslanoglu/turkish_cities/issues/29): Add ```district``` class and ```list_subdistricts``` method for listing subdistricts
22
+
23
+ * [#27](https://github.com/sarslanoglu/turkish_cities/issues/27): Add all subdistricts and neighborhoods of all Turkish cities
24
+
25
+ * [#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
26
+
27
+ ### Changes
28
+
29
+ * [#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
30
+
31
+ ## 0.1.3 (2020-04-20)
32
+
33
+ ### New features
34
+
35
+ * [#22](https://github.com/sarslanoglu/turkish_cities/issues/22): Add region data to cities.yaml and update ```list_cities``` method to support regions
36
+
37
+ * [#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
38
+
39
+ ### Bug fixes
40
+
41
+ * [#18](https://github.com/sarslanoglu/turkish_cities/issues/18): Fix yaml file read error while deploying apps to Heroku
42
+
43
+ ## 0.1.2 (2020-04-13)
44
+
45
+ ### New features
46
+
47
+ * [#3](https://github.com/sarslanoglu/turkish_cities/issues/3): Change city_list data to yaml file format
48
+
49
+ ### Bug fixes
50
+
51
+ * [#2](https://github.com/sarslanoglu/turkish_cities/issues/2): Fix capital Turkish characters bug on cities with capital 'I' letter
52
+
53
+ ### Changes
54
+
55
+ * [#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
56
+
57
+ ## 0.1.1 (2020-03-31)
58
+
59
+ ### Changes
60
+
61
+ * Fix homepage problem on .gemspec file
@@ -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
@@ -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
@@ -0,0 +1,3 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
@@ -0,0 +1,78 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ turkish_cities (0.2.1)
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.3)
19
+ docile (1.3.2)
20
+ i18n (1.8.3)
21
+ concurrent-ruby (~> 1.0)
22
+ json (2.3.0)
23
+ parallel (1.19.2)
24
+ parser (2.7.1.4)
25
+ ast (~> 2.4.1)
26
+ rainbow (3.0.0)
27
+ regexp_parser (1.7.1)
28
+ rexml (3.2.4)
29
+ rspec (3.9.0)
30
+ rspec-core (~> 3.9.0)
31
+ rspec-expectations (~> 3.9.0)
32
+ rspec-mocks (~> 3.9.0)
33
+ rspec-core (3.9.2)
34
+ rspec-support (~> 3.9.3)
35
+ rspec-expectations (3.9.2)
36
+ diff-lcs (>= 1.2.0, < 2.0)
37
+ rspec-support (~> 3.9.0)
38
+ rspec-mocks (3.9.1)
39
+ diff-lcs (>= 1.2.0, < 2.0)
40
+ rspec-support (~> 3.9.0)
41
+ rspec-support (3.9.3)
42
+ rubocop (0.86.0)
43
+ parallel (~> 1.10)
44
+ parser (>= 2.7.0.1)
45
+ rainbow (>= 2.2.2, < 4.0)
46
+ regexp_parser (>= 1.7)
47
+ rexml
48
+ rubocop-ast (>= 0.0.3, < 1.0)
49
+ ruby-progressbar (~> 1.7)
50
+ unicode-display_width (>= 1.4.0, < 2.0)
51
+ rubocop-ast (0.0.3)
52
+ parser (>= 2.7.0.1)
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.9.0)
74
+ rubocop (~> 0.86.0)
75
+ turkish_cities!
76
+
77
+ BUNDLED WITH
78
+ 2.1.4
@@ -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.
@@ -0,0 +1,267 @@
1
+ # 🏙️ Turkish Cities
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
+ [![Coverage Status](https://coveralls.io/repos/github/sarslanoglu/turkish_cities/badge.svg?branch=master)](https://coveralls.io/github/sarslanoglu/turkish_cities?branch=master)
5
+ [![Maintainability](https://api.codeclimate.com/v1/badges/c1dbe0cef353b152956e/maintainability)](https://codeclimate.com/github/sarslanoglu/turkish_cities/maintainability)
6
+ [![Test Coverage](https://api.codeclimate.com/v1/badges/c1dbe0cef353b152956e/test_coverage)](https://codeclimate.com/github/sarslanoglu/turkish_cities/test_coverage)
7
+ [![Protected by Hound](https://img.shields.io/badge/Protected_by-Hound-a873d1.svg)](https://houndci.com)
8
+ [![License](https://img.shields.io/github/license/sarslanoglu/turkish_cities.svg)](https://opensource.org/licenses/MIT)
9
+
10
+ **turkish_cities** is a Ruby gem which makes searching and listing Turkish cities easy. https://rubygems.org/gems/turkish_cities
11
+
12
+ ## Table of Contents
13
+ * [Installation](#installation)
14
+ * [Documentation](#documentation)
15
+ * [Finding city name by plate number](#finding-city-name-by-plate-number)
16
+ * [Finding city name by phone code](#finding-city-name-by-phone-code)
17
+ * [Finding plate number by city name](#finding-plate-number-by-city-name)
18
+ * [Finding phone code by city name](#finding-phone-code-by-city-name)
19
+ * [Listing all cities](#listing-all-cities)
20
+ * [Listing all cities with only name](#listing-all-cities-with-only-name)
21
+ * [Listing all cities with other parameters](#listing-all-cities-with-other-parameters)
22
+ * [Listing all districts of given city](#listing-all-districts-of-given-city)
23
+ * [Listing all subdistricts of given city and district](#listing-all-subdistricts-of-given-city-and-district)
24
+ * [Listing all neighborhoods of given city and district](#listing-all-neighborhoods-of-given-city-and-district)
25
+ * [With subdistrict info](#with-subdistrict-info)
26
+ * [Without subdistrict info](#without-subdistrict-info)
27
+ * [Finding city, district and subdistrict name by postcode](#finding-city-district-and-subdistrict-name-by-postcode)
28
+ * [Compatibility](#compatibility)
29
+ * [Contributing](#contributing)
30
+ * [Changelog](#changelog)
31
+ * [Copyright](#copyright)
32
+
33
+ ## Installation
34
+
35
+ Installation is pretty standard:
36
+
37
+ ```sh
38
+ $ gem install turkish_cities
39
+ ```
40
+
41
+ or with using Bundler, add this line to your Gemfile
42
+
43
+ ```rb
44
+ gem 'turkish_cities'
45
+ ```
46
+
47
+ and run
48
+
49
+ ```sh
50
+ $ bundle
51
+ ```
52
+
53
+ ## Documentation
54
+
55
+ With using irb just require gem and start using
56
+
57
+ ```rb
58
+ require 'turkish_cities'
59
+ ```
60
+
61
+ ### Finding city name by plate number
62
+
63
+ There are 81 cities in Turkey. By calling a plate number between 1-81 will give city_name.
64
+
65
+ ```rb
66
+ TurkishCities.find_name_by_plate_number(26) # => "Eskişehir"
67
+ TurkishCities.find_name_by_plate_number(7) # => "Antalya"
68
+ TurkishCities.find_name_by_plate_number(0007) # => "Antalya"
69
+ TurkishCities.find_name_by_plate_number(43.0) # => "Kütahya"
70
+ TurkishCities.find_name_by_plate_number('78') # => "Karabük"
71
+ TurkishCities.find_name_by_plate_number(100) # => 'Given value [100] is outside bounds of 1 to 81.'
72
+ ```
73
+
74
+ ### Finding city name by phone code
75
+
76
+ 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.
77
+
78
+ ```rb
79
+ TurkishCities.find_name_by_phone_code(312) # => "Ankara"
80
+ TurkishCities.find_name_by_phone_code(242) # => "Antalya"
81
+ TurkishCities.find_name_by_phone_code(000222) # => "Eskişehir"
82
+ TurkishCities.find_name_by_phone_code(274.0) # => "Kütahya"
83
+ TurkishCities.find_name_by_phone_code('212') # => "İstanbul"
84
+ TurkishCities.find_name_by_phone_code(216) # => "İstanbul"
85
+ TurkishCities.find_name_by_phone_code(360) # => 'Couldn't find city name with phone code 360'
86
+ TurkishCities.find_name_by_phone_code(0) # => 'Given value [0] is outside bounds of 212 to 488.'
87
+ TurkishCities.find_name_by_phone_code(213) # => 'Given value [213] must be an even number.'
88
+ ```
89
+
90
+ ### Finding plate number by city name
91
+
92
+ City name can be given case and turkish character insensitive.
93
+
94
+ ```rb
95
+ TurkishCities.find_plate_number_by_name('Ankara') # => 6
96
+ TurkishCities.find_plate_number_by_name('Eskişehir') # => 26
97
+ TurkishCities.find_plate_number_by_name('Canakkale') # => 17
98
+ TurkishCities.find_plate_number_by_name('Istanbul') # => 34
99
+ TurkishCities.find_plate_number_by_name('kirsehir') # => 40
100
+ TurkishCities.find_plate_number_by_name('falansehir') # => "Couldn't find city name with 'falansehir'"
101
+ ```
102
+
103
+ ### Finding phone code by city name
104
+
105
+ City name can be given case and turkish character insensitive.
106
+
107
+ ```rb
108
+ TurkishCities.find_phone_code_by_name('Ankara') # => 312
109
+ TurkishCities.find_phone_code_by_name('Eskişehir') # => 222
110
+ TurkishCities.find_phone_code_by_name('Canakkale') # => 286
111
+ TurkishCities.find_phone_code_by_name('Istanbul') # => [212, 216]
112
+ TurkishCities.find_phone_code_by_name('kirsehir') # => 386
113
+ TurkishCities.find_phone_code_by_name('filansehir') # => "Couldn't find city name with 'filansehir'"
114
+ ```
115
+
116
+ ### Listing all cities
117
+
118
+ By default cities will be listed by their plate number ascending.
119
+
120
+ ```rb
121
+ TurkishCities.list_cities # => ["Adana", "Adıyaman" ... "Kilis", "Osmaniye", "Düzce"]
122
+ ```
123
+
124
+ ### Listing all cities with only name
125
+
126
+ While listing cities three additional parameters can be send ```alphabetically_sorted```, ```metropolitan_municipality``` and ```region```. All parameters can be send seperately and together.
127
+
128
+ ```rb
129
+ TurkishCities.list_cities({ alphabetically_sorted: true })
130
+ # => ["Adana", "Adıyaman" ... "Yalova", "Yozgat", "Zonguldak"]
131
+ TurkishCities.list_cities({ metropolitan_municipality: true })
132
+ # => ["Adana", "Ankara" ... "Trabzon", "Şanlıurfa", "Van"]
133
+ TurkishCities.list_cities({ region: 'Karadeniz' })
134
+ # => ["Amasya", "Artvin" ... "Bartın", "Karabük", "Düzce"]
135
+ TurkishCities.list_cities({ alphabetically_sorted: true, region: 'Karadeniz' })
136
+ # => ["Amasya", "Artvin" ... "Tokat", "Trabzon", "Zonguldak"]
137
+ TurkishCities.list_cities({ metropolitan_municipality: true, region: 'Karadeniz' })
138
+ # => ["Ordu", "Samsun", "Trabzon"]
139
+ TurkishCities.list_cities({ alphabetically_sorted: true, metropolitan_municipality: true })
140
+ # => ["Adana", "Ankara" ... "Tekirdağ", "Trabzon", "Van"]
141
+ ```
142
+
143
+ ### Listing all cities with other parameters
144
+
145
+ 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.
146
+
147
+ ```rb
148
+ TurkishCities.list_cities({ alphabetically_sorted: true, with: { phone_code: true } })
149
+ # => [{:name=>"Adana", :phone_code=>322}, {:name=>"Adıyaman", :phone_code=>416}, {:name=>"Afyon", :phone_code=>272} .
150
+ # .. {:name=>"Yozgat", :phone_code=>354}, {:name=>"Zonguldak", :phone_code=>372}]
151
+ TurkishCities.list_cities({ with: { plate_number: true } })
152
+ # => [{:name=>"Adana", :plate_number=>1}, {:name=>"Adıyaman", :plate_number=>2}, {:name=>"Afyon", :plate_number=>3} .
153
+ # .. {:name=>"Osmaniye", :plate_number=>80}, {:name=>"Düzce", :plate_number=>81}]
154
+ TurkishCities.list_cities({ metropolitan_municipality: true, region: 'Karadeniz', with: { all: true } })
155
+ # => [{:name=>"Ordu", :plate_number=>52, :phone_code=>452, :metropolitan_municipality_since=>2012,
156
+ # :region=>"Karadeniz"},{:name=>"Samsun", :plate_number=>55, :phone_code=>362,
157
+ # :metropolitan_municipality_since=>1993, :region=>"Karadeniz"}, {:name=>"Trabzon", :plate_number=>61,
158
+ # :phone_code=>462, :metropolitan_municipality_since=>2012, :region=>"Karadeniz"}]
159
+ ```
160
+
161
+ ### Listing all districts of given city
162
+
163
+ City name can be given case and turkish character insensitive. Listing of districts are alphabetically sorted.
164
+
165
+ ```rb
166
+ TurkishCities.list_districts('Ankara')
167
+ # => ["Akyurt", "Altındağ" ... "Sincan", "Şereflikoçhisar", "Yenimahalle"]
168
+ TurkishCities.list_districts('Eskişehir')
169
+ # => ["Alpu", "Beylikova", "Çifteler" ... "Sivrihisar", "Tepebaşı"]
170
+ TurkishCities.list_districts('Canakkale')
171
+ # => ["Ayvacık", "Bayramiç" ... "Lapseki", "Merkez", "Yenice"]
172
+ TurkishCities.list_districts('Bayburt')
173
+ # => ["Aydıntepe", "Demirözü", "Merkez"]
174
+ TurkishCities.list_districts('Istanbul').length
175
+ # => 39
176
+ TurkishCities.list_districts('filansehir')
177
+ # => "Couldn't find city name with 'filansehir'"
178
+ ```
179
+
180
+ ### Listing all subdistricts of given city and district
181
+
182
+ 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.
183
+
184
+ ```rb
185
+ TurkishCities.list_subdistricts('Adana', 'Seyhan')
186
+ # => ["Akkapı", "Denizli" ... "Yeşiloba", "Yeşilyurt", "Ziyapaşa"]
187
+ TurkishCities.list_subdistricts('Eskişehir', 'Odunpazarı')
188
+ # => ["Alanönü", "Arifiye", "Büyükdere" ... "Vişnelik", "Yenikent"]
189
+ TurkishCities.list_subdistricts('Istanbul', 'Beşiktaş')
190
+ # => ["Abbasağa", "Akatlar", "Arnavutköy", "Bebek", "Etiler", "Gayrettepe", "Levazım", "Levent", "Ortaköy", "Türkali"]
191
+ TurkishCities.list_subdistricts('filansehir', 'Beşiktaş')
192
+ # => "Couldn't find district name with 'Beşiktaş' of 'filansehir'"
193
+ TurkishCities.list_subdistricts('İstanbul', 'Kadılarköyü')
194
+ # => "Couldn't find district name with 'Kadılarköyü' of 'İstanbul'"
195
+ ```
196
+
197
+ ### Listing all neighborhoods of given city and district
198
+
199
+ ### With subdistrict info
200
+
201
+ 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.
202
+
203
+ ```rb
204
+ TurkishCities.list_neighborhoods('Adana', 'Seyhan', 'Emek')
205
+ # => ["Emek Mah", "Ova Mah", "Şakirpaşa Mah", "Uçak Mah"]
206
+ TurkishCities.list_neighborhoods('Eskişehir', 'Odunpazarı', 'Büyükdere')
207
+ # => ["Büyükdere Mah", "Göztepe Mah", "Gültepe Mah", "Yıldıztepe Mah"]
208
+ TurkishCities.list_neighborhoods('Istanbul', 'Beşiktaş', 'Gayrettepe')
209
+ # => ["Balmumcu Mah", "Dikilitaş Mah", "Gayrettepe Mah", "Yıldız Mah"]
210
+ TurkishCities.list_neighborhoods('Adana', 'Beşiktaş', 'Emek')
211
+ # => "Couldn't find district name with 'Beşiktaş' of 'Adana'"
212
+ TurkishCities.list_neighborhoods('Eskişehir', 'Odunpazarı', 'Büyükkkkkdere')
213
+ # => "Couldn't find subdistrict with 'Büyükkkkkdere' of 'Odunpazarı'/'Eskişehir'"
214
+ ```
215
+
216
+ ### Without subdistrict info
217
+
218
+ Also ```list_neighborhoods``` can work without subdistrict information. This time neighborhoods result will be larger based on searched city and district.
219
+
220
+ 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.
221
+
222
+ ```rb
223
+ TurkishCities.list_neighborhoods('Adana', 'Seyhan')
224
+ # => ["2000 Evler Mah", "Ahmet Remzi Yüreğir Mah", "Akkapı Mah" ... "Zeytinli Mah", "Ziyapaşa Mah"]
225
+ TurkishCities.list_neighborhoods('Eskişehir', 'Odunpazarı')
226
+ # => ["71 Evler Mah", "75. Yıl Osb Mah" ... "Yukarıkalabak Mah", "Yürükkaracaören Mah", "Yürükkırka Mah"]
227
+ TurkishCities.list_neighborhoods('Istanbul', 'Beşiktaş')
228
+ # => ["Abbasağa Mah", "Akat Mah", "Arnavutköy Mah" ... "Türkali Mah", "Ulus Mah", "Vişnezade Mah", "Yıldız Mah"]
229
+ TurkishCities.list_neighborhoods('İstanbul', 'filanmevki')
230
+ # => "Couldn't find district name with 'filanmevki' of 'İstanbul'"
231
+ ```
232
+
233
+ ### Finding city, district and subdistrict name by postcode
234
+
235
+ 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
236
+
237
+ ```rb
238
+ TurkishCities.find_by_postcode(34380) # => ["İstanbul", "Şişli", "Cumhuriyet"]
239
+ TurkishCities.find_by_postcode(34433) # => ["İstanbul", "Beyoğlu", "Cihangir"]
240
+ TurkishCities.find_by_postcode('26040') # => ["Eskişehir", "Odunpazarı", "Büyükdere"]
241
+ TurkishCities.find_by_postcode(34382) # => "Couldn't find any subdistrict with postcode '34382'"
242
+ TurkishCities.find_by_postcode('100000') # => Given value [100000] is outside bounds of 1010 to 81952.
243
+ ```
244
+
245
+ ## Compatibility
246
+
247
+ | Ruby Version | Supported |
248
+ | ------------ | ------------------ |
249
+ | 2.7.1 | :white_check_mark: |
250
+ | 2.6.6 | :white_check_mark: |
251
+ | 2.5.8 | :white_check_mark: |
252
+ | < 2.5.1 | :x: |
253
+
254
+ - This gem 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.
255
+
256
+ ## Contributing
257
+
258
+ Contributing guidelines are available [here](CONTRIBUTING.md).
259
+
260
+ ## Changelog
261
+
262
+ Changelog is available [here](CHANGELOG.md).
263
+
264
+ ## Copyright
265
+
266
+ Copyright (c) 2020 Semih Arslanoglu. See [LICENSE.txt](LICENSE.txt) for
267
+ further details.