Sha256: 65da2c0ebd07ca9b46431091ed874f063d62c56da33b1245d51c2b4a3ae7103e

Contents?: true

Size: 460 Bytes

Versions: 3

Compression:

Stored size: 460 Bytes

Contents

class Wettr::IPAPI
  include HTTParty
  # debug_output STDOUT

  base_uri "https://ipapi.co"
  # https://ipapi.co/1.1.1.1/json

  def self.call_without_ip
    response = self.get("/json")
    
    if response["error"]
      puts "Encountered the following error with IPAPI.co:"
      puts response["reason"]
      puts response["message"]

      exit
    end

    response
  end

  private

  def self.call
    response = self.class.get("#{ip}/json")
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
wettr-0.1.2 lib/wettr/ip_api.rb
wettr-0.1.1 lib/wettr/ip_api.rb
wettr-0.1.0 lib/wettr/ip_api.rb