rentlinx 0.7.0 → 0.7.1
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/rentlinx/errors.rb +6 -0
- data/lib/rentlinx/models/property_link.rb +1 -1
- data/lib/rentlinx/models/unit_link.rb +1 -1
- data/lib/rentlinx/modules/amenity_client_methods.rb +4 -2
- data/lib/rentlinx/modules/link_client_methods.rb +15 -12
- data/lib/rentlinx/modules/linkable.rb +1 -3
- data/lib/rentlinx/modules/photo_client_methods.rb +4 -2
- data/lib/rentlinx/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ef85bce9f2ff14a271f922916dbd8c3698204df4
|
4
|
+
data.tar.gz: 31f3863df3a5104030ea8e978e193bb57e5104c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: efbd029b6d1463d9e321949507141bf4b6f2b895d96bb68fc2ca3cfce82759a3b6d2adba6db81376ca1604e2885ed5b64bc5b96a11e62aa0b1b394707aaa4581
|
7
|
+
data.tar.gz: bd45c674674e197bc7c6227fdf51fcdb9587471b5065e57a34acd057c56f5525fca36a421feed553909ffbd4e5997f5d3ad20b35801191b83b78a1e934a99ea8
|
data/lib/rentlinx/errors.rb
CHANGED
@@ -20,6 +20,12 @@ module Rentlinx
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
+
class IncompatibleGroupOfObjectsForPost < RentlinxError
|
24
|
+
def initialize(property)
|
25
|
+
super("These objects cannot be grouped together ('#{property}' differ).")
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
23
29
|
class HTTPError < RentlinxError
|
24
30
|
attr_reader :response
|
25
31
|
|
@@ -1,8 +1,10 @@
|
|
1
1
|
module Rentlinx
|
2
2
|
module AmenityClientMethods
|
3
3
|
def post_amenities(amenities)
|
4
|
-
|
5
|
-
raise
|
4
|
+
return if amenities.nil?
|
5
|
+
raise(Rentlinx::InvalidObject, amenities.find { |a| !a.valid? }) unless amenities.all?(&:valid?)
|
6
|
+
raise(Rentlinx::IncompatibleGroupOfObjectsForPost, 'propertyID') unless amenities.all? { |p| p.propertyID == amenities.first.propertyID }
|
7
|
+
|
6
8
|
property_amenities = amenities.select { |p| p.class == Rentlinx::PropertyAmenity }
|
7
9
|
unit_amenities = amenities - property_amenities
|
8
10
|
|
@@ -1,8 +1,11 @@
|
|
1
1
|
module Rentlinx
|
2
2
|
module LinkClientMethods
|
3
3
|
def post_links(links)
|
4
|
-
|
5
|
-
|
4
|
+
return if links.nil?
|
5
|
+
|
6
|
+
raise(Rentlinx::InvalidObject, links.find { |a| !a.valid? }) unless links.all?(&:valid?)
|
7
|
+
raise(Rentlinx::IncompatibleGroupOfObjectsForPost, 'propertyID') unless links.all? { |p| p.propertyID == links.first.propertyID }
|
8
|
+
|
6
9
|
property_links = links.select { |l| l.class == Rentlinx::PropertyLink }
|
7
10
|
unit_links = links - property_links
|
8
11
|
|
@@ -26,17 +29,17 @@ module Rentlinx
|
|
26
29
|
|
27
30
|
def get_links_for_unit(unit)
|
28
31
|
links = get_links_for_property_id(unit.propertyID)
|
29
|
-
links.select { |
|
32
|
+
links.select { |link| defined? link.unitID && link.unitID == unit.unitID }
|
30
33
|
end
|
31
34
|
|
32
35
|
def unpost_link(link)
|
33
36
|
case link
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
37
|
+
when Rentlinx::UnitLink
|
38
|
+
unpost_unit_link(link.unitID, link.url)
|
39
|
+
when Rentlinx::PropertyLink
|
40
|
+
unpost_property_link(link.propertyID, link.url)
|
41
|
+
else
|
42
|
+
raise TypeError, "Invalid type: #{link.class}"
|
40
43
|
end
|
41
44
|
end
|
42
45
|
|
@@ -62,11 +65,11 @@ module Rentlinx
|
|
62
65
|
end
|
63
66
|
|
64
67
|
def unpost_property_link(id, url)
|
65
|
-
request('DELETE', URI.encode("properties/#{id}/links/"),
|
68
|
+
request('DELETE', URI.encode("properties/#{id}/links/"), url: url)
|
66
69
|
end
|
67
70
|
|
68
71
|
def unpost_unit_link(id, url)
|
69
|
-
request('DELETE', URI.encode("units/#{id}/links/"),
|
72
|
+
request('DELETE', URI.encode("units/#{id}/links/"), url: url)
|
70
73
|
end
|
71
74
|
end
|
72
|
-
end
|
75
|
+
end
|
@@ -1,8 +1,10 @@
|
|
1
1
|
module Rentlinx
|
2
2
|
module PhotoClientMethods
|
3
3
|
def post_photos(photos)
|
4
|
-
return
|
5
|
-
|
4
|
+
return if photos.nil?
|
5
|
+
raise(Rentlinx::InvalidObject, photos.find { |p| !p.valid? }) unless photos.all?(&:valid?)
|
6
|
+
raise(Rentlinx::IncompatibleGroupOfObjectsForPost, 'propertyID') unless photos.all? { |p| p.propertyID == photos.first.propertyID }
|
7
|
+
|
6
8
|
property_photos = photos.select { |p| p.class == Rentlinx::PropertyPhoto }
|
7
9
|
unit_photos = photos - property_photos
|
8
10
|
|
data/lib/rentlinx/version.rb
CHANGED