Class: TopsConnect::Owner

Inherits:
Base
  • Object
show all
Defined in:
lib/tops_connect/owner.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

#addressesObject



13
14
15
16
17
# File 'lib/tops_connect/owner.rb', line 13

def addresses
  @addresses ||= data['Addresses'].map do |record|
    TopsConnect::Address.new(record, owner: self)
  end
end

#alternate_mailing_addressesObject



19
20
21
22
23
24
# File 'lib/tops_connect/owner.rb', line 19

def alternate_mailing_addresses
  addresses
    .select { |address| address.type == 'Alternate' }
    .map(&:formatted)
    .compact
end

#alternate_nameObject



38
39
40
# File 'lib/tops_connect/owner.rb', line 38

def alternate_name
  data['AlternateName']
end

#alternate_phoneObject



48
49
50
51
52
# File 'lib/tops_connect/owner.rb', line 48

def alternate_phone
  phone = data['Phones'].find { |row| row['Type']['Name'] == 'Alternate' }

  phone['PhoneNumber'] if phone
end

#community_keyObject



30
31
32
# File 'lib/tops_connect/owner.rb', line 30

def community_key
  data['CommunityKey']
end

#faxObject



54
55
56
57
58
# File 'lib/tops_connect/owner.rb', line 54

def fax
  phone = data['Phones'].find { |row| row['Type']['Name'] == 'Fax' }

  phone['PhoneNumber'] if phone
end

#hold_collection?Boolean

Returns:

  • (Boolean)


96
97
98
# File 'lib/tops_connect/owner.rb', line 96

def hold_collection?
  data['Metadata']['HoldCollection']
end

#hold_payment?Boolean

Returns:

  • (Boolean)


92
93
94
# File 'lib/tops_connect/owner.rb', line 92

def hold_payment?
  data['Metadata']['HoldPayment']
end

#home_phoneObject



42
43
44
45
46
# File 'lib/tops_connect/owner.rb', line 42

def home_phone
  phone = data['Phones'].find { |row| row['Type']['Name'] == 'Home' }

  phone['PhoneNumber'] if phone
end


34
35
36
# File 'lib/tops_connect/owner.rb', line 34

def legal_name
  data['LegalName']
end

#move_out_dateObject



80
81
82
83
84
# File 'lib/tops_connect/owner.rb', line 80

def move_out_date
  return unless data['MoveOutDate']

  Time.parse data['MoveOutDate']
end

#owner?Boolean

Returns:

  • (Boolean)


72
73
74
# File 'lib/tops_connect/owner.rb', line 72

def owner?
  data['ResidentType'] == 'Owner'
end

#owner_keyObject Also known as: id



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

def owner_key
  data['Key']
end

#property_keyObject



26
27
28
# File 'lib/tops_connect/owner.rb', line 26

def property_key
  data['PropertyKey']
end

#settlement_dateObject



86
87
88
89
90
# File 'lib/tops_connect/owner.rb', line 86

def settlement_date
  return unless data['SettlementDate']

  Time.parse data['SettlementDate']
end

#tenant?Boolean

Returns:

  • (Boolean)


76
77
78
# File 'lib/tops_connect/owner.rb', line 76

def tenant?
  data['ResidentType'] == 'Tenant'
end

#tops_idObject

The internal key used by Tops Pro - property number, homeowner type, owner number in the format PPPPPPTOOO.



102
103
104
# File 'lib/tops_connect/owner.rb', line 102

def tops_id
  data['Metadata']['TopsId']
end

#updated_atObject



66
67
68
69
70
# File 'lib/tops_connect/owner.rb', line 66

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

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

#work_phoneObject



60
61
62
63
64
# File 'lib/tops_connect/owner.rb', line 60

def work_phone
  phone = data['Phones'].find { |row| row['Type']['Name'] == 'Work' }

  phone['PhoneNumber'] if phone
end