class TopsConnect::Property

Public Instance Methods

account_number() click to toggle source
# File lib/tops_connect/property.rb, line 13
def account_number
  data['AccountNumber']
end
address() click to toggle source
# File lib/tops_connect/property.rb, line 17
def address
  [*address_lines_with_unit_number, city_state_zip]
    .map(&:strip)
    .select { |line| line.match?(/[[:graph:]]/) }
    .join("\n")
end
city_state_zip() click to toggle source
# File lib/tops_connect/property.rb, line 35
def city_state_zip
  "#{property['City']}, #{property['State']} #{property['Zip']}"
end
community_key() click to toggle source
# File lib/tops_connect/property.rb, line 24
def community_key
  data['CommunityKey']
end
id()
Alias for: property_key
modified_date() click to toggle source
# File lib/tops_connect/property.rb, line 28
def modified_date
  return unless data['Metadata']['ModifiedDate']

  Time.parse data['Metadata']['ModifiedDate']
end
Also aliased as: updated_at
property_key() click to toggle source
# File lib/tops_connect/property.rb, line 8
def property_key
  data['Key']
end
Also aliased as: id
updated_at()
Alias for: modified_date

Protected Instance Methods

address_lines_with_unit_number() click to toggle source

Sometimes the unit number is alone on the second line

# File lib/tops_connect/property.rb, line 47
def address_lines_with_unit_number
  if property['AddressLine2'].match?(/\A\d+\z/)
    return ["#{property['AddressLine1']} ##{property['AddressLine2']}"]
  end

  [
    property['AddressLine1'],
    property['AddressLine2']
  ]
end
property() click to toggle source
# File lib/tops_connect/property.rb, line 41
def property
  @property ||= data['Addresses']
    .find { |row| row.dig('Type', 'Name') == 'Property' }
end