Class: TopsConnect::Owner
- Inherits:
-
Base
- Object
- Base
- TopsConnect::Owner
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
Instance Method Details
#addresses ⇒ Object
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_addresses ⇒ Object
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_name ⇒ Object
38
39
40
|
# File 'lib/tops_connect/owner.rb', line 38
def alternate_name
data['AlternateName']
end
|
#alternate_phone ⇒ Object
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
|
30
31
32
|
# File 'lib/tops_connect/owner.rb', line 30
def
data['CommunityKey']
end
|
#fax ⇒ Object
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
96
97
98
|
# File 'lib/tops_connect/owner.rb', line 96
def hold_collection?
data['Metadata']['HoldCollection']
end
|
#hold_payment? ⇒ Boolean
92
93
94
|
# File 'lib/tops_connect/owner.rb', line 92
def hold_payment?
data['Metadata']['HoldPayment']
end
|
#home_phone ⇒ Object
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
|
#legal_name ⇒ Object
34
35
36
|
# File 'lib/tops_connect/owner.rb', line 34
def legal_name
data['LegalName']
end
|
#move_out_date ⇒ Object
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
72
73
74
|
# File 'lib/tops_connect/owner.rb', line 72
def owner?
data['ResidentType'] == 'Owner'
end
|
#owner_key ⇒ Object
Also known as:
id
8
9
10
|
# File 'lib/tops_connect/owner.rb', line 8
def owner_key
data['Key']
end
|
#property_key ⇒ Object
26
27
28
|
# File 'lib/tops_connect/owner.rb', line 26
def property_key
data['PropertyKey']
end
|
#settlement_date ⇒ Object
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
76
77
78
|
# File 'lib/tops_connect/owner.rb', line 76
def tenant?
data['ResidentType'] == 'Tenant'
end
|
#tops_id ⇒ Object
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_at ⇒ Object
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_phone ⇒ Object
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
|