class MelissaData::WebSmart::PropertyXMLParser

Public Instance Methods

build_subdictionary(xml_vals) click to toggle source
# File lib/melissa_data/web_smart/xml.rb, line 48
def build_subdictionary(xml_vals)
  keys = xml_vals.map(&:name)
  vals = xml_vals.map { |v| v.children.first.text unless children? v }
  viperize_hash(keys.zip(vals).to_h)
end
expected_fields() click to toggle source
# File lib/melissa_data/web_smart/xml.rb, line 54
def expected_fields
  [ "Building", "CurrentDeed", "CurrentSale", "Lot", "Owner",
    "OwnerAddress", "Parcel", "ParsedPropertyAddress", "PriorSale",
    "PropertyAddress", "RecordID", "Result", "SquareFootage", "Values"]
end
expected_fields?(fields) click to toggle source
# File lib/melissa_data/web_smart/xml.rb, line 60
def expected_fields?(fields)
  expected_fields == fields.sort
end
expected_retrieved?() click to toggle source
# File lib/melissa_data/web_smart/xml.rb, line 72
def expected_retrieved?
  expected_fields?(retrieved_fields)
end
field_details() click to toggle source
# File lib/melissa_data/web_smart/xml.rb, line 44
def field_details
  record_node.children.map(&:children)
end
parse() click to toggle source
# File lib/melissa_data/web_smart/xml.rb, line 35
def parse
  parsed_hash = {}
  if expected_retrieved?
    retrieved_fields.each_with_index { |f, i| parsed_hash[f] = { data: field_details[i] } }
    parsed_hash.keys.each { |k| parsed_hash[k] = build_subdictionary(parsed_hash[k][:data]) }
    viperize_hash(parsed_hash)
  end
end
record_node() click to toggle source
# File lib/melissa_data/web_smart/xml.rb, line 64
def record_node
  xml_document.children.first.children.last # its just how they structure it..
end
retrieved_fields() click to toggle source
# File lib/melissa_data/web_smart/xml.rb, line 68
def retrieved_fields
  record_node.children.map(&:name)
end