class Geocoder::Result::PcMiler

Public Instance Methods

address(format=:unused) click to toggle source

sample response: singlesearch.alk.com/na/api/search?authToken=<TOKEN>&include=Meta&query=Feasterville

{
  "Err": 0,
  "ErrString": "OK",
  "QueryConfidence": 1,
  "TimeInMilliseconds": 93,
  "GridDataVersion": "GRD_ALK.NA.2023.01.18.29.1.1",
  "CommitID": "pcmws-22.08.11.0-1778-g586da49bd1b: 05/30/2023 20:14",
  "Locations": [
    {
      "Address": {
        "StreetAddress": "",
        "LocalArea": "",
        "City": "Feasterville",
        "State": "PA",
        "StateName": "Pennsylvania",
        "Zip": "19053",
        "County": "Bucks",
        "Country": "US",
        "CountryFullName": "United States",
        "SPLC": null
      },
      "Coords": {
        "Lat": "40.150025",
        "Lon": "-75.002511"
      },
      "StreetCoords": {
        "Lat": "40.150098",
        "Lon": "-75.002827"
      },
      "Region": 4,
      "POITypeID": 0,
      "PersistentPOIID": -1,
      "SiteID": -1,
      "ResultType": 4,
      "ShortString": "Feasterville",
      "GridID": 37172748,
      "LinkID": 188,
      "Percent": 6291,
      "TimeZone": "GMT-4:00 EDT"
    }
  ]
}
# File lib/geocoder/results/pc_miler.rb, line 51
def address(format=:unused)
  [street, city, state, postal_code, country]
  .map { |i| i == '' ? nil : i }
  .compact
  .join(', ')
end
city() click to toggle source
# File lib/geocoder/results/pc_miler.rb, line 67
def city
  address_data["City"]
end
coordinates() click to toggle source
# File lib/geocoder/results/pc_miler.rb, line 58
def coordinates
  coords = data["Coords"] || {}
  [coords["Lat"].to_f, coords["Lon"].to_f]
end
country() click to toggle source
# File lib/geocoder/results/pc_miler.rb, line 83
def country
  address_data["CountryFullName"]
end
country_code() click to toggle source
# File lib/geocoder/results/pc_miler.rb, line 87
def country_code
  address_data["Country"]
end
postal_code() click to toggle source
# File lib/geocoder/results/pc_miler.rb, line 79
def postal_code
  address_data["Zip"]
end
state() click to toggle source
# File lib/geocoder/results/pc_miler.rb, line 71
def state
  address_data["StateName"]
end
state_code() click to toggle source
# File lib/geocoder/results/pc_miler.rb, line 75
def state_code
  address_data["State"]
end
street() click to toggle source
# File lib/geocoder/results/pc_miler.rb, line 63
def street
  address_data["StreetAddress"]
end

Private Instance Methods

address_data() click to toggle source
# File lib/geocoder/results/pc_miler.rb, line 93
def address_data
  data["Address"] || {}
end