Class: TopsConnect::Property

Inherits:
Base
  • Object
show all
Defined in:
lib/tops_connect/property.rb

Instance Attribute Summary

Attributes inherited from Base

#data

Instance Method Summary collapse

Methods inherited from Base

#[], #initialize

Constructor Details

This class inherits a constructor from TopsConnect::Base

Instance Method Details

#account_numberObject



13
14
15
# File 'lib/tops_connect/property.rb', line 13

def 
  data['AccountNumber']
end

#addressObject



17
18
19
20
21
22
# 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_zipObject



35
36
37
# File 'lib/tops_connect/property.rb', line 35

def city_state_zip
  "#{property['City']}, #{property['State']} #{property['Zip']}"
end

#community_keyObject



24
25
26
# File 'lib/tops_connect/property.rb', line 24

def community_key
  data['CommunityKey']
end

#modified_dateObject Also known as: updated_at



28
29
30
31
32
# File 'lib/tops_connect/property.rb', line 28

def modified_date
  return unless data['Metadata']['ModifiedDate']

  Time.parse data['Metadata']['ModifiedDate']
end

#property_keyObject Also known as: id



8
9
10
# File 'lib/tops_connect/property.rb', line 8

def property_key
  data['Key']
end