tops_connect 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/tops_connect.rb +3 -0
- data/lib/tops_connect/base.rb +12 -0
- data/lib/tops_connect/client.rb +2 -0
- data/lib/tops_connect/owner.rb +99 -0
- data/lib/tops_connect/owners.rb +4 -8
- data/lib/tops_connect/version.rb +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c12dc89e03b14593d72f2eb5e7d784b39ee2c994
|
4
|
+
data.tar.gz: 1432be52961935df235d278c6b068139414c7395
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a39e2abd5217e9c3dce0177f67d08a59cf53a35416bf48dc57ae66fec2d66aa0c06b0013e54ab6fe665e2ccd62480ed63c925ff1469f2bb2d94763287e584fa5
|
7
|
+
data.tar.gz: 85ebb9698513db3964d6a5c14f3e9b02fe6a1befefa09700c05aa945ac2a88ca219f7933ea980928825bf89de94f5e929d9f73551dc8fd5cbc9fe81a07ca8ea8
|
data/lib/tops_connect.rb
CHANGED
data/lib/tops_connect/client.rb
CHANGED
@@ -0,0 +1,99 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module TopsConnect
|
3
|
+
class Owner < Base
|
4
|
+
attr_reader :id
|
5
|
+
|
6
|
+
def initialize(id, data = nil)
|
7
|
+
@id = id.to_i
|
8
|
+
@data = data
|
9
|
+
end
|
10
|
+
|
11
|
+
def data
|
12
|
+
@data ||= get "/owner/#{@id}"
|
13
|
+
end
|
14
|
+
|
15
|
+
def alternate_mailing_addresses
|
16
|
+
[1, 2].map do |n|
|
17
|
+
next unless data["AltMailing#{n}AddressLine1"]
|
18
|
+
|
19
|
+
city = data["AltMailing#{n}City"]
|
20
|
+
state = data["AltMailing#{n}State"]
|
21
|
+
zip = data["AltMailing#{n}Zip"]
|
22
|
+
|
23
|
+
lines = [data["AltMailing#{n}AddressLine1"]]
|
24
|
+
|
25
|
+
if data["AltMailing#{n}AddressLine2"] !~ /[^[:space:]]/
|
26
|
+
lines << data["AltMailing#{n}AddressLine2"]
|
27
|
+
end
|
28
|
+
|
29
|
+
lines << "#{city}, #{state} #{zip}"
|
30
|
+
|
31
|
+
lines.reject(&:blank?).join("\n")
|
32
|
+
end.compact
|
33
|
+
end
|
34
|
+
|
35
|
+
def property_id
|
36
|
+
data['PropertyKey']
|
37
|
+
end
|
38
|
+
|
39
|
+
def community_id
|
40
|
+
data['CommunityKey']
|
41
|
+
end
|
42
|
+
|
43
|
+
def legal_name
|
44
|
+
data['LegalName']
|
45
|
+
end
|
46
|
+
|
47
|
+
def alternate_name
|
48
|
+
data['AlternateName']
|
49
|
+
end
|
50
|
+
|
51
|
+
def home_phone
|
52
|
+
data['PhoneHome']
|
53
|
+
end
|
54
|
+
|
55
|
+
def alternate_phone
|
56
|
+
data['PhoneAlt']
|
57
|
+
end
|
58
|
+
|
59
|
+
def fax
|
60
|
+
data['PhoneFax']
|
61
|
+
end
|
62
|
+
|
63
|
+
def work_phone
|
64
|
+
data['PhoneWork']
|
65
|
+
end
|
66
|
+
|
67
|
+
def updated_at
|
68
|
+
DateTime.parse data['Metadata']['ModifiedDate']
|
69
|
+
end
|
70
|
+
|
71
|
+
def owner?
|
72
|
+
data['ResidentType'] == 'Owner'
|
73
|
+
end
|
74
|
+
|
75
|
+
def tenant?
|
76
|
+
data['ResidentType'] == 'Tenant'
|
77
|
+
end
|
78
|
+
|
79
|
+
def move_out_date
|
80
|
+
DateTime.parse data['MoveOutDate'] if data['MoveOutDate']
|
81
|
+
end
|
82
|
+
|
83
|
+
def settlement_date
|
84
|
+
DateTime.parse data['SettlementDate'] if data['SettlementDate']
|
85
|
+
end
|
86
|
+
|
87
|
+
# Method: GET
|
88
|
+
# Endpoint: Balance_Get
|
89
|
+
def balance
|
90
|
+
get "/balance/#{@id}"
|
91
|
+
end
|
92
|
+
|
93
|
+
# Method: GET
|
94
|
+
# Endpoint: Charge_Get
|
95
|
+
def charges
|
96
|
+
get "/charge/#{@id}"
|
97
|
+
end
|
98
|
+
end
|
99
|
+
end
|
data/lib/tops_connect/owners.rb
CHANGED
@@ -4,7 +4,7 @@ module TopsConnect
|
|
4
4
|
# Method: GET
|
5
5
|
# Endpoint: Owner_Get
|
6
6
|
def owner(owner_id)
|
7
|
-
|
7
|
+
TopsConnect::Owner.new owner_id
|
8
8
|
end
|
9
9
|
|
10
10
|
# Method: GET
|
@@ -13,13 +13,9 @@ module TopsConnect
|
|
13
13
|
parameters = {}
|
14
14
|
parameters['PropertyKey'] = property_id.to_i if property_id
|
15
15
|
|
16
|
-
get
|
17
|
-
|
18
|
-
|
19
|
-
# Method: GET
|
20
|
-
# Endpoint: Balance_Get
|
21
|
-
def balance(owner_id)
|
22
|
-
get "/balance/#{owner_id.to_i}"
|
16
|
+
get('/owner', parameters).map do |owner|
|
17
|
+
TopsConnect::Owner.new owner['OwnerKey'], owner
|
18
|
+
end
|
23
19
|
end
|
24
20
|
end
|
25
21
|
end
|
data/lib/tops_connect/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tops_connect
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steven Hoffman
|
@@ -97,9 +97,11 @@ files:
|
|
97
97
|
- bin/console
|
98
98
|
- bin/setup
|
99
99
|
- lib/tops_connect.rb
|
100
|
+
- lib/tops_connect/base.rb
|
100
101
|
- lib/tops_connect/client.rb
|
101
102
|
- lib/tops_connect/communities.rb
|
102
103
|
- lib/tops_connect/configuration.rb
|
104
|
+
- lib/tops_connect/owner.rb
|
103
105
|
- lib/tops_connect/owners.rb
|
104
106
|
- lib/tops_connect/version.rb
|
105
107
|
- tops_connect.gemspec
|