tops_connect 0.6.3 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +8 -0
- data/Gemfile +3 -0
- data/Rakefile +3 -0
- data/lib/tops_connect.rb +4 -0
- data/lib/tops_connect/address.rb +65 -0
- data/lib/tops_connect/base.rb +3 -0
- data/lib/tops_connect/client.rb +3 -0
- data/lib/tops_connect/communities.rb +3 -0
- data/lib/tops_connect/community.rb +3 -0
- data/lib/tops_connect/configuration.rb +3 -0
- data/lib/tops_connect/errors.rb +3 -0
- data/lib/tops_connect/owner.rb +11 -28
- data/lib/tops_connect/owners.rb +10 -0
- data/lib/tops_connect/properties.rb +3 -0
- data/lib/tops_connect/property.rb +3 -0
- data/lib/tops_connect/version.rb +4 -1
- data/tops_connect.gemspec +3 -0
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 25146db0b362c11ca40ef5bbdeee94bdf96b553621c2e17ec89a71ddf4191d3a
|
4
|
+
data.tar.gz: b8452b408a025c569ada9f92bfcb98634a57e530b3c40d91fab710b8b33a240c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b1fbaa926f85020a68ea1dc3025066959d071d5a359a9a486b95fba4b1741ad20ed2ddc3bb0fb9405fd35246d5f22fc9113f80064b9ed148e31b912f60bdba7c
|
7
|
+
data.tar.gz: e81c9290de6fc9ba3ac4aa036bef8be2421fc6d5885afba375b78890c94b2edef1a2fee1b5c4ce407385e35190038cdd88bb7036f18a1cecb9bc5a33d1ada360
|
data/.rubocop.yml
CHANGED
@@ -10,3 +10,11 @@ Layout/MultilineMethodCallIndentation:
|
|
10
10
|
Metrics/BlockLength:
|
11
11
|
Exclude:
|
12
12
|
- 'spec/**/*.rb'
|
13
|
+
|
14
|
+
Style/Copyright:
|
15
|
+
# AutocorrectNotice: |
|
16
|
+
# # Copyright (c) 2019 Valencia Management Group
|
17
|
+
# # All rights reserved.
|
18
|
+
Notice: '^# Copyright (\(c\) )?2[0-9]{3} .+'
|
19
|
+
Exclude:
|
20
|
+
- 'bin/**/*'
|
data/Gemfile
CHANGED
data/Rakefile
CHANGED
data/lib/tops_connect.rb
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
# Copyright (c) 2019 Valencia Management Group
|
4
|
+
# All rights reserved.
|
5
|
+
|
3
6
|
require 'base64'
|
4
7
|
require 'httparty'
|
5
8
|
require 'json'
|
@@ -15,6 +18,7 @@ require 'tops_connect/base'
|
|
15
18
|
require 'tops_connect/community'
|
16
19
|
require 'tops_connect/owner'
|
17
20
|
require 'tops_connect/property'
|
21
|
+
require 'tops_connect/address'
|
18
22
|
|
19
23
|
require 'tops_connect/configuration'
|
20
24
|
require 'tops_connect/client'
|
@@ -0,0 +1,65 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Copyright (c) 2019 Valencia Management Group
|
4
|
+
# All rights reserved.
|
5
|
+
|
6
|
+
module TopsConnect
|
7
|
+
class Address < Base
|
8
|
+
attr_reader :owner
|
9
|
+
|
10
|
+
TYPES = {
|
11
|
+
'Main' => 1,
|
12
|
+
'Home' => 2,
|
13
|
+
'Work' => 3,
|
14
|
+
'Other' => 4,
|
15
|
+
'Return Payment' => 5,
|
16
|
+
'Lockbox' => 6,
|
17
|
+
'Community Office' => 7,
|
18
|
+
'Management Office' => 8,
|
19
|
+
'Alternate' => 9,
|
20
|
+
'Billing' => 10,
|
21
|
+
'Property' => 11,
|
22
|
+
'Shipping' => 12
|
23
|
+
}.freeze
|
24
|
+
|
25
|
+
def initialize(data, owner:)
|
26
|
+
super(data)
|
27
|
+
|
28
|
+
@owner = owner
|
29
|
+
end
|
30
|
+
|
31
|
+
def type
|
32
|
+
@data['Type']['Name']
|
33
|
+
end
|
34
|
+
|
35
|
+
def to_s
|
36
|
+
lines = address_lines
|
37
|
+
|
38
|
+
return if lines.empty?
|
39
|
+
|
40
|
+
# Foreign addresses do not have City/State/Zip
|
41
|
+
if @data['City'] && @data['State'] && @data['Zip']
|
42
|
+
lines << "#{@data['City']}, #{@data['State']} #{@data['Zip']}"
|
43
|
+
end
|
44
|
+
|
45
|
+
lines.map(&:strip).join("\n")
|
46
|
+
end
|
47
|
+
alias formatted to_s
|
48
|
+
|
49
|
+
protected
|
50
|
+
|
51
|
+
def address_lines
|
52
|
+
lines = []
|
53
|
+
|
54
|
+
if @data['AddressLine1'].match?(/[[:graph:]]/)
|
55
|
+
lines << @data['AddressLine1']
|
56
|
+
end
|
57
|
+
|
58
|
+
if @data['AddressLine2'].match?(/[[:graph:]]/)
|
59
|
+
lines << @data['AddressLine2']
|
60
|
+
end
|
61
|
+
|
62
|
+
lines
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
data/lib/tops_connect/base.rb
CHANGED
data/lib/tops_connect/client.rb
CHANGED
data/lib/tops_connect/errors.rb
CHANGED
data/lib/tops_connect/owner.rb
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
# Copyright (c) 2019 Valencia Management Group
|
4
|
+
# All rights reserved.
|
5
|
+
|
3
6
|
module TopsConnect
|
4
7
|
class Owner < Base
|
5
8
|
def owner_key
|
@@ -7,10 +10,16 @@ module TopsConnect
|
|
7
10
|
end
|
8
11
|
alias id owner_key
|
9
12
|
|
13
|
+
def addresses
|
14
|
+
@addresses ||= data['Addresses'].map do |record|
|
15
|
+
TopsConnect::Address.new(record, owner: self)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
10
19
|
def alternate_mailing_addresses
|
11
20
|
data['Addresses']
|
12
|
-
.select { |
|
13
|
-
.map
|
21
|
+
.select { |address| address.type == 'Alternate' }
|
22
|
+
.map(&:formatted)
|
14
23
|
.compact
|
15
24
|
end
|
16
25
|
|
@@ -93,31 +102,5 @@ module TopsConnect
|
|
93
102
|
def tops_id
|
94
103
|
data['Metadata']['TopsId']
|
95
104
|
end
|
96
|
-
|
97
|
-
protected
|
98
|
-
|
99
|
-
def offsite_address(address)
|
100
|
-
lines = address_lines(address)
|
101
|
-
|
102
|
-
return if lines.empty?
|
103
|
-
|
104
|
-
lines << "#{address['City']}, #{address['State']} #{address['Zip']}"
|
105
|
-
|
106
|
-
lines.map(&:strip).join("\n")
|
107
|
-
end
|
108
|
-
|
109
|
-
def address_lines(address)
|
110
|
-
lines = []
|
111
|
-
|
112
|
-
if address['AddressLine1'].match?(/[[:graph:]]/)
|
113
|
-
lines << address['AddressLine1']
|
114
|
-
end
|
115
|
-
|
116
|
-
if address['AddressLine2'].match?(/[[:graph:]]/)
|
117
|
-
lines << address['AddressLine2']
|
118
|
-
end
|
119
|
-
|
120
|
-
lines
|
121
|
-
end
|
122
105
|
end
|
123
106
|
end
|
data/lib/tops_connect/owners.rb
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
# Copyright (c) 2019 Valencia Management Group
|
4
|
+
# All rights reserved.
|
5
|
+
|
3
6
|
module TopsConnect
|
4
7
|
module Owners
|
5
8
|
# Method: GET
|
@@ -34,5 +37,12 @@ module TopsConnect
|
|
34
37
|
def charges(owner_key)
|
35
38
|
get "/charge/#{owner_key}"
|
36
39
|
end
|
40
|
+
|
41
|
+
# Method: PUT
|
42
|
+
# Endpoint: Owner_Put
|
43
|
+
# Returns: Hash
|
44
|
+
def update_owner!(owner_key, data)
|
45
|
+
put "/owner/#{owner_key}", body: data
|
46
|
+
end
|
37
47
|
end
|
38
48
|
end
|
data/lib/tops_connect/version.rb
CHANGED
data/tops_connect.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tops_connect
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steven Hoffman
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-12-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -97,6 +97,7 @@ files:
|
|
97
97
|
- bin/console
|
98
98
|
- bin/setup
|
99
99
|
- lib/tops_connect.rb
|
100
|
+
- lib/tops_connect/address.rb
|
100
101
|
- lib/tops_connect/base.rb
|
101
102
|
- lib/tops_connect/client.rb
|
102
103
|
- lib/tops_connect/communities.rb
|
@@ -128,7 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
128
129
|
- !ruby/object:Gem::Version
|
129
130
|
version: '0'
|
130
131
|
requirements: []
|
131
|
-
rubygems_version: 3.
|
132
|
+
rubygems_version: 3.1.2
|
132
133
|
signing_key:
|
133
134
|
specification_version: 4
|
134
135
|
summary: Make use of the Tops Connect API
|