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

#alternate_mailing_addressesObject



10
11
12
13
14
15
# File 'lib/tops_connect/owner.rb', line 10

def alternate_mailing_addresses
  data['Addresses']
    .select { |row| row['Type']['Name'] == 'Alternate' }
    .map { |row| offsite_address(row) }
    .compact
end

#alternate_nameObject



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

def alternate_name
  data['AlternateName']
end

#alternate_phoneObject



39
40
41
42
43
# File 'lib/tops_connect/owner.rb', line 39

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

  phone['PhoneNumber'] if phone
end

#community_keyObject



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

def community_key
  data['CommunityKey']
end

#faxObject



45
46
47
48
49
# File 'lib/tops_connect/owner.rb', line 45

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

  phone['PhoneNumber'] if phone
end

#hold_collection?Boolean

Returns:

  • (Boolean)


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

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

#hold_payment?Boolean

Returns:

  • (Boolean)


83
84
85
# File 'lib/tops_connect/owner.rb', line 83

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

#home_phoneObject



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

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

  phone['PhoneNumber'] if phone
end


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

def legal_name
  data['LegalName']
end

#move_out_dateObject



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

def move_out_date
  return unless data['MoveOutDate']

  Time.parse data['MoveOutDate']
end

#owner?Boolean

Returns:

  • (Boolean)


63
64
65
# File 'lib/tops_connect/owner.rb', line 63

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

#owner_keyObject Also known as: id



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

def owner_key
  data['Key']
end

#property_keyObject



17
18
19
# File 'lib/tops_connect/owner.rb', line 17

def property_key
  data['PropertyKey']
end

#settlement_dateObject



77
78
79
80
81
# File 'lib/tops_connect/owner.rb', line 77

def settlement_date
  return unless data['SettlementDate']

  Time.parse data['SettlementDate']
end

#tenant?Boolean

Returns:

  • (Boolean)


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

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.



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

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

#updated_atObject



57
58
59
60
61
# File 'lib/tops_connect/owner.rb', line 57

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

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

#work_phoneObject



51
52
53
54
55
# File 'lib/tops_connect/owner.rb', line 51

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

  phone['PhoneNumber'] if phone
end