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



10
11
12
# File 'lib/tops_connect/property.rb', line 10

def 
  data['AccountNumber']
end

#addressObject



14
15
16
17
18
19
# File 'lib/tops_connect/property.rb', line 14

def address
  [*address_lines_with_unit_number, city_state_zip]
    .map(&:strip)
    .select { |line| line.match?(/[[:graph:]]/) }
    .join("\n")
end

#city_state_zipObject



32
33
34
# File 'lib/tops_connect/property.rb', line 32

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

#community_keyObject



21
22
23
# File 'lib/tops_connect/property.rb', line 21

def community_key
  data['CommunityKey']
end

#modified_dateObject Also known as: updated_at



25
26
27
28
29
# File 'lib/tops_connect/property.rb', line 25

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

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

#property_keyObject Also known as: id



5
6
7
# File 'lib/tops_connect/property.rb', line 5

def property_key
  data['Key']
end