Giter VIP home page Giter VIP logo

ipapi-crystal's Introduction

ipapi-crystal

Crystal CI GitHub release Docs License

Crystal bindings for https://ipapi.co (IP Address Location & Geolocation API)

Installation

  1. Add the dependency to your shard.yml:

    dependencies:
      ipapi:
        github: geocrystal/ipapi-crystal
  2. Run shards install

Usage

require "ipapi"

client = Ipapi::Client.new

location = client.locate("8.8.8.8")
# => #<Ipapi::Location:0x780aff839b40 @ip="8.8.8.8", @network="8.8.8.0/24", @version="IPv4", @city="Mountain View", @region="California", @region_code="CA", @country="US", @country_name="United States", @country_code="US", @country_code_iso3="USA", @country_capital="Washington", @country_tld=".us", @continent_code="NA", @in_eu=false, @postal="94043", @latitude=37.42301, @longitude=-122.083352, @timezone="America/Los_Angeles", @utc_offset="-0700", @country_calling_code="+1", @currency="USD", @currency_name="Dollar", @languages="en-US,es-US,haw,fr", @country_area=9629091.0, @country_population=327167434, @asn="AS15169", @org="GOOGLE">

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 (https://github.com/geocrystal/ipapi-crystal/fork)
  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

ipapi-crystal's People

Contributors

mamantoha avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.