rentlinx 0.6.3 → 0.6.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7c4c82401201b6ad6f998bdbc418d05f5a384cf4
4
- data.tar.gz: 1e61f78593e5d405c3f1df858dfb2a67efa00326
3
+ metadata.gz: e2740162e7118e91691469b2e109bd986ba12035
4
+ data.tar.gz: 7aeacb872e3d5d3918fcda207bc92495398023f1
5
5
  SHA512:
6
- metadata.gz: e98fcebad846c67cb45f6dfef0c7225b0c00029d0e6b3ffa6845a565a5137f7d720a72804ff63f08360a2440433a01cf7926b0d6d56b384edf2e3a2e16c13c9c
7
- data.tar.gz: e1f7c46e79a89598c968fcd639d54acf132ae5d009dc4bd446ef5e0a966cea7a7a53cadaa5dcd35a2454bbe9b511a1cae432552fd7d6e7f81478d52929a93427
6
+ metadata.gz: a1c442c102d79edf089b9b930a4ef6c8208a0b952dee07319f9b0f252ac5cca186dd8a0e0631e178a2acb310a0decce6c3cc2c4ab369b05d23fab045353a53f9
7
+ data.tar.gz: 9d8bdad6526f21b77cd77302a3f3fe3de6e2d1984b8e2a876c24012488b671a1c80a1345668730e52799254f5208f155d7eb2ac25dac37a8b55f00f1a6b3baff
@@ -1,4 +1,5 @@
1
1
  require 'rentlinx/modules/photoable'
2
+ require 'rentlinx/modules/amenityable'
2
3
 
3
4
  module Rentlinx
4
5
  class Property < Base
@@ -38,6 +39,11 @@ module Rentlinx
38
39
  Rentlinx::PropertyPhoto
39
40
  end
40
41
 
42
+ include Rentlinx::Amenityable
43
+ def amenity_class
44
+ Rentlinx::PropertyAmenity
45
+ end
46
+
41
47
  private
42
48
 
43
49
  def get_units_for_property_id(id)
@@ -1,4 +1,5 @@
1
1
  require 'rentlinx/modules/photoable'
2
+ require 'rentlinx/modules/amenityable'
2
3
 
3
4
  module Rentlinx
4
5
  class Unit < Base
@@ -18,6 +19,11 @@ module Rentlinx
18
19
  Rentlinx::UnitPhoto
19
20
  end
20
21
 
22
+ include Rentlinx::Amenityable
23
+ def amenity_class
24
+ Rentlinx::UnitAmenity
25
+ end
26
+
21
27
  def photos
22
28
  super.select { |p| p.unitID == unitID }
23
29
  end
@@ -0,0 +1,38 @@
1
+ module Rentlinx
2
+ module Amenityable
3
+ def post_with_amenities
4
+ post
5
+ post_amenities
6
+ end
7
+
8
+ def post_amenities
9
+ Rentlinx.client.post_amenities(@amenities)
10
+ end
11
+
12
+ def amenities
13
+ return @amenities if @amenities
14
+
15
+ @amenities =
16
+ if defined? unitID
17
+ Rentlinx.client.get_amenities_for_unit(self)
18
+ else
19
+ Rentlinx.client.get_amenities_for_property_id(propertyID)
20
+ end
21
+ end
22
+
23
+ def amenities=(amenity_list)
24
+ @amenities = amenity_list.map do |amenity|
25
+ amenity.propertyID = propertyID
26
+ amenity.unitID = unitID if defined? unitID
27
+ amenity
28
+ end
29
+ end
30
+
31
+ def add_amenity(options)
32
+ options.merge!(propertyID: propertyID)
33
+ options.merge!(unitID: unitID) if defined? unitID
34
+ @amenities ||= []
35
+ @amenities << amenity_class.new(options)
36
+ end
37
+ end
38
+ end
@@ -1,3 +1,3 @@
1
1
  module Rentlinx
2
- VERSION = '0.6.3'
2
+ VERSION = '0.6.4'
3
3
  end
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.6.3
4
+ version: 0.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - AppFolio, Inc.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-27 00:00:00.000000000 Z
11
+ date: 2015-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httpclient
@@ -72,6 +72,7 @@ files:
72
72
  - lib/rentlinx/models/unit_amenity.rb
73
73
  - lib/rentlinx/models/unit_photo.rb
74
74
  - lib/rentlinx/modules/amenity_client_methods.rb
75
+ - lib/rentlinx/modules/amenityable.rb
75
76
  - lib/rentlinx/modules/photo_client_methods.rb
76
77
  - lib/rentlinx/modules/photoable.rb
77
78
  - lib/rentlinx/modules/property_client_methods.rb