Sha256: e2b29a78fd786aaf504e02a53b992ed46300d2adeb14012e2d3ee61bf7677c65

Contents?: true

Size: 1.85 KB

Versions: 3

Compression:

Stored size: 1.85 KB

Contents

require 'rest-client'
require 'nokogiri'
require 'json'

module MelissaData
  module WebSmart
    class PropertyAPI
      def property_by_apn(fips:, apn:)
        resp = RestClient.get('https://property.melissadata.net/v3/REST/Service.svc/doLookup/',
                             { params: { id: MelissaData.web_smart_id,
                                         fips: fips,
                                         apn: apn,
                                         opt: "True" } })
        PropertyXMLParser.new(Nokogiri::XML(resp)).parse
      end

      def property_by_address_key(address_key:)
        resp = RestClient.get('https://property.melissadata.net/v3/REST/Service.svc/doLookup/',
                             { params: { id: MelissaData.web_smart_id,
                                         AddressKey: address_key,
                                         opt: "True" } })
        PropertyXMLParser.new(Nokogiri::XML(resp)).parse
      end

      def address(address:, city:, state:, zip:, country:)
        resp = JSON.parse(RestClient.get("https://personator.melissadata.net/v3/WEB/ContactVerify/doContactVerify",
                                         { params: { id: MelissaData.web_smart_id,
                                                     Actions: "Check",
                                                     a1: address,
                                                     city: city,
                                                     state: state,
                                                     postal: zip,
                                                     ctry: country,
                                                     AdvancedAddressCorrection: "on",},
                                           accept: :json,
                                           content_type: :json }))
        resp["Records"].first
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
melissa_data-0.2.14 lib/melissa_data/web_smart/property_api.rb
melissa_data-0.2.13 lib/melissa_data/web_smart/property_api.rb
melissa_data-0.2.12 lib/melissa_data/web_smart/property_api.rb