Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/geocrystal/ipapi-crystal
Crystal bindings for https://ipapi.co (IP Address Location & Geolocation API)
https://github.com/geocrystal/ipapi-crystal
crystal geolocation geolocation-api ipaddress ipapi ipapi-co
Last synced: 22 days ago
JSON representation
Crystal bindings for https://ipapi.co (IP Address Location & Geolocation API)
- Host: GitHub
- URL: https://github.com/geocrystal/ipapi-crystal
- Owner: geocrystal
- License: mit
- Created: 2024-04-05T08:17:18.000Z (7 months ago)
- Default Branch: main
- Last Pushed: 2024-06-01T17:10:18.000Z (6 months ago)
- Last Synced: 2024-10-04T21:31:47.240Z (about 1 month ago)
- Topics: crystal, geolocation, geolocation-api, ipaddress, ipapi, ipapi-co
- Language: Crystal
- Homepage: https://geocrystal.github.io/ipapi-crystal/
- Size: 44.9 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ipapi-crystal
[![Crystal CI](https://github.com/geocrystal/ipapi-crystal/actions/workflows/crystal.yml/badge.svg)](https://github.com/geocrystal/ipapi-crystal/actions/workflows/crystal.yml)
[![GitHub release](https://img.shields.io/github/release/geocrystal/ipapi-crystal.svg)](https://github.com/geocrystal/ipapi-crystal/releases)
[![Docs](https://img.shields.io/badge/docs-available-brightgreen.svg)](https://geocrystal.github.io/ipapi-crystal/)
[![License](https://img.shields.io/github/license/geocrystal/ipapi-crystal.svg)](https://github.com/geocrystal/ipapi-crystal/blob/main/LICENSE)Crystal bindings for (IP Address Location & Geolocation API)
## Installation
1. Add the dependency to your `shard.yml`:
```yaml
dependencies:
ipapi:
github: geocrystal/ipapi-crystal
```2. Run `shards install`
## Usage
```crystal
require "ipapi"client = Ipapi::Client.new
location = client.locate("8.8.8.8")
# => #location.ip # "8.8.8.8"
location.network # "8.8.8.0/24"
location.version # "IPv4"
location.city # "Mountain View"
location.region # "California"
location.region_code # "CA"
location.country # "US"
location.country_name # "United States"
location.country_code # "US"
location.country_code_iso3 # "USA"
location.country_capital # "Washington"
location.country_tld # ".us"
location.continent_code # "NA"
location.in_eu # false
location.postal # "95843"
location.latitude # 37.42301
location.longitude # -122.083352
location.timezone # "America/Los_Angeles"
location.utc_offset # "-0700"
location.country_calling_code # "+1"
location.currency # "USD"
location.currency_name # "Dollar"
location.languages # "en-US,es-US,haw,fr"
location.country_area # 9629091.0
location.country_population # 327167434
location.asn # "AS7065"
location.org # "SNIC"
```## Contributing
1. Fork it ()
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request## Contributors
- [Anton Maminov](https://github.com/mamantoha) - creator and maintainer