rentlinx 0.9.6 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rentlinx.rb +2 -2
- data/lib/rentlinx/models/base.rb +12 -10
- data/lib/rentlinx/models/company.rb +2 -2
- data/lib/rentlinx/models/lead.rb +2 -2
- data/lib/rentlinx/models/property.rb +2 -2
- data/lib/rentlinx/models/property_amenity.rb +2 -2
- data/lib/rentlinx/models/property_link.rb +2 -2
- data/lib/rentlinx/models/property_photo.rb +2 -2
- data/lib/rentlinx/models/unit.rb +2 -2
- data/lib/rentlinx/modules/amenityable.rb +3 -3
- data/lib/rentlinx/modules/linkable.rb +3 -3
- data/lib/rentlinx/modules/photoable.rb +3 -3
- data/lib/rentlinx/validators/attribute_processor_service.rb +1 -1
- data/lib/rentlinx/validators/phone_validator.rb +4 -10
- data/lib/rentlinx/validators/state_validator.rb +1 -1
- data/lib/rentlinx/version.rb +1 -1
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5d84ca87dc674c10fafbf7c3768f741604c35071
|
4
|
+
data.tar.gz: f4a5aa6c95773c2aceea5430b7ed9613d33a9684
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8c8f68214467b6510fe357f5b8807da5b1f4d66b83c9386ef4e2a5e13dbe9c2fddef2a5b9e007e2bd1d3654dcc3cb584abcffc73dc9366671fd7f250c2f08684
|
7
|
+
data.tar.gz: a559470f580ab80c11238dec51c805719acb0825e7fb3539ac6681c884188661fe7a739d43963a15e3eb1a77abdbd1b878e4c7eee14a09725a9770822c3d7087
|
data/lib/rentlinx.rb
CHANGED
@@ -31,8 +31,8 @@ module Rentlinx
|
|
31
31
|
# rentlinx.site_url 'https://rentlinx.com/api/v2'
|
32
32
|
# rentlinx.log_level :error
|
33
33
|
# end
|
34
|
-
def configure
|
35
|
-
|
34
|
+
def configure
|
35
|
+
yield(self)
|
36
36
|
end
|
37
37
|
|
38
38
|
# Sets and retrieves the username used to log in to Rentlinx
|
data/lib/rentlinx/models/base.rb
CHANGED
@@ -23,7 +23,7 @@ module Rentlinx
|
|
23
23
|
send("#{at}=", attrs[at])
|
24
24
|
end
|
25
25
|
remaining_attrs = attrs.keys - attributes
|
26
|
-
raise UnexpectedAttributes, "Unexpected Attributes: #{remaining_attrs.join(', ')}"
|
26
|
+
raise UnexpectedAttributes, "Unexpected Attributes: #{remaining_attrs.join(', ')}" unless remaining_attrs.compact.empty?
|
27
27
|
end
|
28
28
|
|
29
29
|
# Provides a list of attributes supported by the class.
|
@@ -117,22 +117,24 @@ module Rentlinx
|
|
117
117
|
|
118
118
|
private
|
119
119
|
|
120
|
-
|
121
|
-
|
122
|
-
|
120
|
+
class << self
|
121
|
+
def unpost(id)
|
122
|
+
Rentlinx.client.unpost(type, id)
|
123
|
+
end
|
124
|
+
|
125
|
+
def get_from_id(type, id)
|
126
|
+
Rentlinx.client.get(type.to_sym, id)
|
127
|
+
end
|
123
128
|
|
124
|
-
|
125
|
-
|
129
|
+
def type
|
130
|
+
name.split('::').last.downcase.to_sym
|
131
|
+
end
|
126
132
|
end
|
127
133
|
|
128
134
|
def type
|
129
135
|
self.class.type
|
130
136
|
end
|
131
137
|
|
132
|
-
def self.type
|
133
|
-
name.split('::').last.downcase.to_sym
|
134
|
-
end
|
135
|
-
|
136
138
|
def identity
|
137
139
|
type.to_s + 'ID'
|
138
140
|
end
|
@@ -1,9 +1,9 @@
|
|
1
1
|
module Rentlinx
|
2
2
|
# An object that represents a Rentlinx company.
|
3
3
|
class Company < Base
|
4
|
-
ATTRIBUTES = [:companyID, :companyCapAmount]
|
4
|
+
ATTRIBUTES = [:companyID, :companyCapAmount].freeze
|
5
5
|
|
6
|
-
REQUIRED_ATTRIBUTES = [:companyID]
|
6
|
+
REQUIRED_ATTRIBUTES = [:companyID].freeze
|
7
7
|
|
8
8
|
attr_accessor(*ATTRIBUTES)
|
9
9
|
|
data/lib/rentlinx/models/lead.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
module Rentlinx
|
2
2
|
# An object that represets Rentlinx Leads
|
3
3
|
class Lead < Base
|
4
|
-
ATTRIBUTES = [:leadID, :refunded, :refund_reason]
|
5
|
-
REQUIRED_ATTRIBUTES = [:leadID, :refunded, :refund_reason]
|
4
|
+
ATTRIBUTES = [:leadID, :refunded, :refund_reason].freeze
|
5
|
+
REQUIRED_ATTRIBUTES = [:leadID, :refunded, :refund_reason].freeze
|
6
6
|
|
7
7
|
attr_accessor(*ATTRIBUTES)
|
8
8
|
end
|
@@ -10,10 +10,10 @@ module Rentlinx
|
|
10
10
|
:website, :yearBuilt, :numUnits, :phoneNumber, :extension,
|
11
11
|
:faxNumber, :emailAddress, :acceptsHcv, :propertyType,
|
12
12
|
:activeURL, :companyName, :leadsURL,
|
13
|
-
:premium, :capAmount]
|
13
|
+
:premium, :capAmount].freeze
|
14
14
|
|
15
15
|
REQUIRED_ATTRIBUTES = [:propertyID, :address, :city, :state, :zip,
|
16
|
-
:phoneNumber, :emailAddress]
|
16
|
+
:phoneNumber, :emailAddress].freeze
|
17
17
|
|
18
18
|
attr_accessor(*ATTRIBUTES)
|
19
19
|
|
@@ -1,9 +1,9 @@
|
|
1
1
|
module Rentlinx
|
2
2
|
# An amenity on a propery
|
3
3
|
class PropertyAmenity < Base
|
4
|
-
ATTRIBUTES = [:details, :name, :propertyID]
|
4
|
+
ATTRIBUTES = [:details, :name, :propertyID].freeze
|
5
5
|
|
6
|
-
REQUIRED_ATTRIBUTES = [:name, :propertyID]
|
6
|
+
REQUIRED_ATTRIBUTES = [:name, :propertyID].freeze
|
7
7
|
|
8
8
|
attr_accessor(*ATTRIBUTES)
|
9
9
|
|
@@ -1,9 +1,9 @@
|
|
1
1
|
module Rentlinx
|
2
2
|
# A link on a property
|
3
3
|
class PropertyLink < Base
|
4
|
-
ATTRIBUTES = [:propertyID, :title, :url]
|
4
|
+
ATTRIBUTES = [:propertyID, :title, :url].freeze
|
5
5
|
|
6
|
-
REQUIRED_ATTRIBUTES = [:propertyID, :title, :url]
|
6
|
+
REQUIRED_ATTRIBUTES = [:propertyID, :title, :url].freeze
|
7
7
|
|
8
8
|
attr_accessor(*ATTRIBUTES)
|
9
9
|
|
@@ -1,9 +1,9 @@
|
|
1
1
|
module Rentlinx
|
2
2
|
# A photo on a property
|
3
3
|
class PropertyPhoto < Base
|
4
|
-
ATTRIBUTES = [:url, :caption, :position, :propertyID, :unitID]
|
4
|
+
ATTRIBUTES = [:url, :caption, :position, :propertyID, :unitID].freeze
|
5
5
|
|
6
|
-
REQUIRED_ATTRIBUTES = [:url, :propertyID]
|
6
|
+
REQUIRED_ATTRIBUTES = [:url, :propertyID].freeze
|
7
7
|
|
8
8
|
attr_accessor(*ATTRIBUTES)
|
9
9
|
|
data/lib/rentlinx/models/unit.rb
CHANGED
@@ -10,9 +10,9 @@ module Rentlinx
|
|
10
10
|
:bedrooms, :fullBaths, :halfBaths, :isMobilityAccessible,
|
11
11
|
:isVisionAccessible, :isHearingAccessible, :rentIsBasedOnIncome,
|
12
12
|
:isOpenToLease, :dateAvailable, :dateLeasedThrough, :numUnits,
|
13
|
-
:numAvailable]
|
13
|
+
:numAvailable].freeze
|
14
14
|
|
15
|
-
REQUIRED_ATTRIBUTES = [:unitID]
|
15
|
+
REQUIRED_ATTRIBUTES = [:unitID].freeze
|
16
16
|
|
17
17
|
attr_accessor(*ATTRIBUTES)
|
18
18
|
|
@@ -17,7 +17,7 @@ module Rentlinx
|
|
17
17
|
def post_amenities
|
18
18
|
return if @amenities.nil?
|
19
19
|
|
20
|
-
if @amenities.
|
20
|
+
if @amenities.empty?
|
21
21
|
Rentlinx.client.unpost_amenities_for(self)
|
22
22
|
else
|
23
23
|
Rentlinx.client.post_amenities(@amenities)
|
@@ -58,8 +58,8 @@ module Rentlinx
|
|
58
58
|
# {Rentlinx::PropertyAmenity}
|
59
59
|
# @return the updated list of amenities on the object
|
60
60
|
def add_amenity(options)
|
61
|
-
options
|
62
|
-
options
|
61
|
+
options[:propertyID] = propertyID
|
62
|
+
options[:unitID] = unitID if defined? unitID
|
63
63
|
@amenities ||= []
|
64
64
|
@amenities << amenity_class.new(options)
|
65
65
|
end
|
@@ -17,7 +17,7 @@ module Rentlinx
|
|
17
17
|
def post_links
|
18
18
|
return if @links.nil?
|
19
19
|
|
20
|
-
if @links.
|
20
|
+
if @links.empty?
|
21
21
|
Rentlinx.client.unpost_links_for(self)
|
22
22
|
else
|
23
23
|
Rentlinx.client.post_links(@links)
|
@@ -45,8 +45,8 @@ module Rentlinx
|
|
45
45
|
end
|
46
46
|
|
47
47
|
def add_link(options)
|
48
|
-
options
|
49
|
-
options
|
48
|
+
options[:propertyID] = propertyID
|
49
|
+
options[:unitID] = unitID if defined? unitID
|
50
50
|
@links ||= []
|
51
51
|
@links << link_class.new(options)
|
52
52
|
end
|
@@ -12,7 +12,7 @@ module Rentlinx
|
|
12
12
|
def post_photos
|
13
13
|
return if @photos.nil?
|
14
14
|
|
15
|
-
if @photos.
|
15
|
+
if @photos.empty?
|
16
16
|
Rentlinx.client.unpost_photos_for(self)
|
17
17
|
else
|
18
18
|
Rentlinx.client.post_photos(@photos)
|
@@ -32,8 +32,8 @@ module Rentlinx
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def add_photo(options)
|
35
|
-
options
|
36
|
-
options
|
35
|
+
options[:propertyID] = propertyID
|
36
|
+
options[:unitID] = unitID if defined? unitID
|
37
37
|
@photos ||= []
|
38
38
|
@photos << photo_class.new(options)
|
39
39
|
end
|
@@ -5,24 +5,18 @@ module Rentlinx
|
|
5
5
|
def processed_value
|
6
6
|
return '' if value_blank?
|
7
7
|
return @value unless valid?
|
8
|
-
@value.gsub(
|
8
|
+
@value.gsub(/[\+\(\)\s\-]/, '')
|
9
9
|
end
|
10
10
|
|
11
11
|
private
|
12
12
|
|
13
13
|
def validate
|
14
|
-
return if value_blank? ||
|
15
|
-
valid_us_number_without_country_code?(processed_value) ||
|
16
|
-
valid_us_number_with_country_code?(processed_value)
|
14
|
+
return if value_blank? || valid_us_phone_number?(processed_value)
|
17
15
|
@error = "#{@value} is not a valid phone number"
|
18
16
|
end
|
19
17
|
|
20
|
-
def
|
21
|
-
|
22
|
-
end
|
23
|
-
|
24
|
-
def valid_us_number_without_country_code?(number)
|
25
|
-
!number.start_with?('1') && !number.start_with?('0') && number.size == 10
|
18
|
+
def valid_us_phone_number?(number)
|
19
|
+
/^1?[2-9][0-9]{2}[2-9][0-9]{6}$/.match(number)
|
26
20
|
end
|
27
21
|
end
|
28
22
|
end
|
@@ -5,7 +5,7 @@ module Rentlinx
|
|
5
5
|
class StateValidator < BaseValidator
|
6
6
|
STATES = %w(AK AL AR AS AZ CA CO CT DC DE FL GA GU HI IA ID IL IN KS KY LA
|
7
7
|
MA MD ME MI MN MO MP MS MT NC ND NE NH NJ NM NV NY OH OK OR PA
|
8
|
-
PR RI SC SD TN TX UT VA VI VT WA WI WV WY)
|
8
|
+
PR RI SC SD TN TX UT VA VI VT WA WI WV WY).freeze
|
9
9
|
|
10
10
|
private
|
11
11
|
|
data/lib/rentlinx/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rentlinx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- AppFolio, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-05-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httpclient
|
@@ -115,9 +115,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
115
115
|
version: '0'
|
116
116
|
requirements: []
|
117
117
|
rubyforge_project:
|
118
|
-
rubygems_version: 2.
|
118
|
+
rubygems_version: 2.5.1
|
119
119
|
signing_key:
|
120
120
|
specification_version: 4
|
121
121
|
summary: API Wrapper for the Rentlinx API
|
122
122
|
test_files: []
|
123
|
-
has_rdoc:
|