Sha256: 5d04ac719bc38040c0f26d2abbfcf2854eaeb5a02cfb5b18e056d1ed3e19e0ad

Contents?: true

Size: 1.84 KB

Versions: 5

Compression:

Stored size: 1.84 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

5 entries across 5 versions & 1 rubygems

Version Path
melissa_data-0.2.11 lib/melissa_data/web_smart/property_api.rb
melissa_data-0.2.10 lib/melissa_data/web_smart/property_api.rb
melissa_data-0.2.9 lib/melissa_data/web_smart/property_api.rb
melissa_data-0.2.8 lib/melissa_data/web_smart/property_api.rb
melissa_data-0.2.7 lib/melissa_data/web_smart/property_api.rb