Skip to content

Commit

Permalink
add specs
Browse files Browse the repository at this point in the history
  • Loading branch information
mamantoha committed Apr 5, 2024
1 parent 98e6f5d commit 3a3682e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ Crystal bindings for <https://ipapi.co> (IP Address Location & Geolocation API)
```crystal
require "ipapi"
client = Ipapi::Client.new
location = client.locate("50.1.2.3")
# => #<Ipapi::Location:0x7b45cdce5b40 @ip="50.1.2.3", @network="50.1.0.0/21", @version="IPv4", @city="Antelope", @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="95843", @latitude=38.7169, @longitude=-121.3677, @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="AS7065", @org="SNIC">
Expand Down
11 changes: 8 additions & 3 deletions spec/ipapi_spec.cr
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
require "./spec_helper"

describe Ipapi do
# TODO: Write tests
it "#locate" do
client = Ipapi::Client.new

it "works" do
false.should eq(true)
location = client.locate("50.1.2.3")

location.ip.should eq("50.1.2.3")
location.city.should eq("Antelope")
location.region.should eq("California")
location.country.should eq("US")
end
end

0 comments on commit 3a3682e

Please sign in to comment.