README.md in sypex_geo-0.0.1 vs README.md in sypex_geo-0.1.0
- old
+ new
@@ -1,5 +1,7 @@
+[![Gem Version](https://badge.fury.io/rb/sypex_geo.svg)](http://badge.fury.io/rb/sypex_geo)
+
# SypexGeo
[Sypex Geo IP database](http://sypexgeo.net) adapter for Ruby.
## Installation
@@ -10,21 +12,94 @@
And then execute:
$ bundle
-Or install it yourself as:
+## Usage
- $ gem install sypex_geo
+```ruby
+require 'sypex_geo'
-## Usage
+db = SypexGeo::Database.new('./sypex_geo_city_max.dat')
+db.lookup(<IPv4 address>)
+# => {
+# city: {
+# id: 524901,
+# lat: 55,
+# lon: 37,
+# name_ru: 'Москва',
+# name_en: 'Moscow',
+# okato: '45'
+# },
+# country: {
+# id: 185,
+# iso: 'RU'
+# },
+# region: nil
+# }
- require 'sypex_geo'
+# Query details.
+db.lookup(<IPv4 address>, true)
+# => {
+# city: {
+# id: 524901,
+# lat: 55,
+# lon: 37,
+# name_ru: 'Москва',
+# name_en: 'Moscow',
+# okato: '45'
+# },
+# region: {
+# id: 524894,
+# name_ru: 'Москва',
+# name_en: 'Moskva',
+# lat: 55,
+# lon: 37,
+# iso: 'RU-MOW',
+# timezone: 'Europe/Moscow',
+# okato: '45'
+# },
+# country: {
+# id: 185,
+# iso: 'RU',
+# continent: 'EU',
+# lat: 60,
+# lon: 100,
+# name_ru: 'Россия',
+# name_en: 'Russia',
+# timezone: 'Europe/Moscow'
+# }
+# }
- db = SypexGeo::Database.new('./sypex_geo_city_max.dat')
- db.lookup(<IPv4 address>)
+# "memory_mode"
+db = SypexGeo::MemoryDatabase.new('./sypex_geo_city_max.dat')
+db.lookup(<IPv4 address>)
+```
-## License
+## Testing
-Licensed under the MIT License
+ $ SYPEXGEO_CITY_MAX_DB=./sypexgeo_city_max.dat rspec
+## License
+
Copyright (c) 2014 Kolesnikov Danil
+
+MIT License
+
+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:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+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.