From 19e8aeec89bcae5737ff4712bd38deceaaec16b5 Mon Sep 17 00:00:00 2001 From: sarslanoglu Date: Mon, 20 Apr 2020 20:02:13 +0300 Subject: [PATCH] Update markdown files --- CHANGELOG.md | 14 +++++++------- CONTRIBUTING.md | 38 ++++++++++++++++++++++++++++++++++++++ README.md | 46 +++++++++++++++++++++++++++++++++++++++------- 3 files changed, 84 insertions(+), 14 deletions(-) create mode 100644 CONTRIBUTING.md diff --git a/CHANGELOG.md b/CHANGELOG.md index db68ca7..fbf749b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,29 +1,29 @@ # Changelog -## master (unreleased) +## 0.1.3 (2020-04-20) ### New features -* [#23](https://github.com/sarslanoglu/turkish_cities/pull/23): Add region data to cities.yaml and update ```list_cities``` method to support regions -* [#21](https://github.com/sarslanoglu/turkish_cities/pull/21): Add city finding with phone code and vice versa. ```find_name_by_phone_code``` and ```find_phone_code_by_name``` methods are added +* [#22](https://github.com/sarslanoglu/turkish_cities/issues/22): Add region data to cities.yaml and update ```list_cities``` method to support regions +* [#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 ### Bug fixes -* [#19](https://github.com/sarslanoglu/turkish_cities/pull/19): Fix yaml file read error while deploying apps to Heroku +* [#18](https://github.com/sarslanoglu/turkish_cities/issues/18): Fix yaml file read error while deploying apps to Heroku ## 0.1.2 (2020-04-13) ### New features -* [#11](https://github.com/sarslanoglu/turkish_cities/pull/11): Change city_list data to yaml file format +* [#3](https://github.com/sarslanoglu/turkish_cities/issues/3): Change city_list data to yaml file format ### Bug fixes -* [#6](https://github.com/sarslanoglu/turkish_cities/pull/6): Fix capital Turkish characters bug on cities with capital 'I' letter +* [#2](https://github.com/sarslanoglu/turkish_cities/issues/2): Fix capital Turkish characters bug on cities with capital 'I' letter ### Changes -* [#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 +* [#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 ## 0.1.1 (2020-03-31) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..71df7b5 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,38 @@ +# Contributing + +If you discover issues, have ideas for improvements or new features, +please report them to the [issue tracker][1] of the repository or +submit a pull request. Please, try to follow these guidelines when you +do so. + +## Guidelines + +* Read [how to properly contribute to open source projects on GitHub][2]. +* Fork the project. +* Write [good commit messages][3]. +* Use the same coding conventions as the rest of the project. +* Commit and push until you are happy with your contribution. +* Make sure to add tests for it. +* Add an entry to the [Changelog](CHANGELOG.md) accordingly. See [changelog entry format](#changelog-entry-format). +* Make sure the test suite is passing and the code you wrote doesn't produce RuboCop offenses. +* [Squash related commits together][4]. + +### Changelog entry format + +Here are a few examples: + +``` +* [#11](https://github.com/sarslanoglu/turkish_cities/pull/11): Change city_list data to yaml file format +* [#6](https://github.com/sarslanoglu/turkish_cities/pull/6): Fix capital Turkish characters bug on cities with capital 'I' letter +* [#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 +``` + +* Mark it up in [Markdown syntax][5]. +* The entry line should start with `* ` (an asterisk and a space). +* 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): `. + +[1]: https://github.com/sarslanoglu/turkish_cities/issues +[2]: https://www.gun.io/blog/how-to-github-fork-branch-and-pull-request +[3]: https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html +[4]: http://gitready.com/advanced/2009/02/10/squashing-commits-with-rebase.html +[5]: https://daringfireball.net/projects/markdown/syntax \ No newline at end of file diff --git a/README.md b/README.md index 90cda73..5ca5052 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,22 @@ TurkishCities.find_name_by_plate_number('78') # => "Karabük" TurkishCities.find_name_by_plate_number(100) # => 'Given value [100] is outside bounds of 1 to 81.' ``` +### Finding city name by phone code + +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 + +```ruby +TurkishCities.find_name_by_phone_code(312) # => "Ankara" +TurkishCities.find_name_by_phone_code(242) # => "Antalya" +TurkishCities.find_name_by_phone_code(000222) # => "Eskişehir" +TurkishCities.find_name_by_phone_code(274.0) # => "Kütahya" +TurkishCities.find_name_by_phone_code('212') # => "İstanbul" +TurkishCities.find_name_by_phone_code(216) # => "İstanbul" +TurkishCities.find_name_by_phone_code(360) # => 'Couldn't find city name with phone code 360' +TurkishCities.find_name_by_phone_code(0) # => 'Given value [0] is outside bounds of 212 to 488.' +TurkishCities.find_name_by_phone_code(213) # => 'Given value [213] must be an even number.' +``` + ### Finding plate number by city name City name can be given case and turkish character insensitive @@ -57,10 +73,24 @@ City name can be given case and turkish character insensitive TurkishCities.find_plate_number_by_name('Ankara') # => 6 TurkishCities.find_plate_number_by_name('Eskişehir') # => 26 TurkishCities.find_plate_number_by_name('Canakkale') # => 17 +TurkishCities.find_plate_number_by_name('Istanbul') # => 34 TurkishCities.find_plate_number_by_name('kirsehir') # => 40 TurkishCities.find_plate_number_by_name('falansehir') # => "Couldn't find city name with 'falansehir'" ``` +### Finding phone number by city name + +City name can be given case and turkish character insensitive + +```ruby +TurkishCities.find_phone_code_by_name('Ankara') # => 312 +TurkishCities.find_phone_code_by_name('Eskişehir') # => 222 +TurkishCities.find_phone_code_by_name('Canakkale') # => 286 +TurkishCities.find_phone_code_by_name('Istanbul') # => [212, 216] +TurkishCities.find_phone_code_by_name('kirsehir') # => 386 +TurkishCities.find_phone_code_by_name('filansehir') # => "Couldn't find city name with 'filansehir'" +``` + ### Listing all cities By default cities will be listed by their plate number ascending. @@ -69,13 +99,19 @@ By default cities will be listed by their plate number ascending. TurkishCities.list_cities # => ["Adana", "Adıyaman" ... "Kilis", "Osmaniye", "Düzce"] ``` -While listing cities two additional parameters can be send ```alphabetically_sorted``` and ```metropolitan_municipality``` Both parameters can be send seperately and together. +While listing cities three additional parameters can be send ```alphabetically_sorted```, ```metropolitan_municipality``` and ```region```. All parameters can be send seperately and together. ```ruby TurkishCities.list_cities({ alphabetically_sorted: true }) # => ["Adana", "Adıyaman" ... "Yalova", "Yozgat", "Zonguldak"] TurkishCities.list_cities({ metropolitan_municipality: true }) # => ["Adana", "Ankara" ... "Trabzon", "Şanlıurfa", "Van"] +TurkishCities.list_cities({ region: 'Karadeniz' }) +# => ["Amasya", "Artvin" ... "Bartın", "Karabük", "Düzce"] +TurkishCities.list_cities({ alphabetically_sorted: true, region: 'Karadeniz' }) +# => ["Amasya", "Artvin" ... "Tokat", "Trabzon", "Zonguldak"] +TurkishCities.list_cities({ metropolitan_municipality: true, region: 'Karadeniz' }) +# => ["Ordu", "Samsun", "Trabzon"] TurkishCities.list_cities({ alphabetically_sorted: true, metropolitan_municipality: true }) # => ["Adana", "Ankara" ... "Tekirdağ", "Trabzon", "Van"] ``` @@ -90,15 +126,11 @@ TurkishCities.list_cities({ alphabetically_sorted: true, metropolitan_municipali ## Contributing -1. Fork it ( https://github.com/sarslanoglu/turkish_cities/fork ) -2. Create your feature branch (`git checkout -b my-new-feature`) -3. Commit your changes (`git commit -m 'Add some feature'`) -4. Push to the branch (`git push origin my-new-feature`) -5. Create new Pull Request +Contributing guidelines are available [here](CONTRIBUTING.md). ## Changelog -turkish_cities changelog is available [here](CHANGELOG.md). +Changelog is available [here](CHANGELOG.md). ## Copyright