rentlinx 0.9.5 → 0.9.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f7549025796e24f93530a7ace4d0c53cf963a235
4
- data.tar.gz: 0df23be8cdf30f67b85aecd783ce9a6f5757cd6e
3
+ metadata.gz: 4262fdfbae34cb0b07cae309ea4951ec252c1079
4
+ data.tar.gz: 6edeb0ae2679e64cdd2da2d52b02ae3c99e7d497
5
5
  SHA512:
6
- metadata.gz: 2759f86e8890daf4c5ab23ab473f17d72ab1b08032ee6dd92effa268f1fa2bd0315a7d65c6acc68d8dbdcbcd100dae2244a1bf345f84db7e891250af067ae6b6
7
- data.tar.gz: e0d3ee406855750d68059a1bc21c3edf693b2bd04e7af2b484bf2dd47cf1be69aad24de88ad2c339dcf4ccf81ef4efc3943fd2cb2a7a3fa7419ae2e85b820214
6
+ metadata.gz: 53353972541e04bc5041328882e663cd74ec3e6c54243d6ba2e2dcb9c700cbf8cea7a5092d341603cce60f4b7b90e0ac4eeacab1763526044473d346a7674deb
7
+ data.tar.gz: 6cdf39903e498e3c0afa2fdf7c2b91874a8e333623a223b23e864827ca082d11b2eeeb8acd65f898eb5fa102ff57f5a9ca645b543fdcba97e5041c4497b31d6c
data/lib/rentlinx.rb CHANGED
@@ -3,6 +3,7 @@ require 'rentlinx/client'
3
3
  require 'rentlinx/errors'
4
4
  require 'rentlinx/models/base'
5
5
  require 'rentlinx/models/company'
6
+ require 'rentlinx/models/lead'
6
7
  require 'rentlinx/models/property'
7
8
  require 'rentlinx/models/unit'
8
9
  require 'rentlinx/models/property_photo'
@@ -8,6 +8,7 @@ require 'rentlinx/modules/unit_client_methods'
8
8
  require 'rentlinx/modules/photo_client_methods'
9
9
  require 'rentlinx/modules/amenity_client_methods'
10
10
  require 'rentlinx/modules/link_client_methods'
11
+ require 'rentlinx/modules/lead_client_methods'
11
12
 
12
13
  module Rentlinx
13
14
  # This class and its included modules encapsulate all
@@ -22,6 +23,7 @@ module Rentlinx
22
23
  include Rentlinx::PhotoClientMethods
23
24
  include Rentlinx::AmenityClientMethods
24
25
  include Rentlinx::LinkClientMethods
26
+ include Rentlinx::LeadClientMethods
25
27
 
26
28
  # Returns a new instance of client. Avoid using.
27
29
  #
@@ -57,16 +59,17 @@ module Rentlinx
57
59
  #
58
60
  # @param object [Rentlinx::Base] the object to be posted
59
61
  def post(object)
62
+ raise Rentlinx::InvalidObject, object if object.respond_to?(:valid?) && !object.valid?
63
+
60
64
  case object
61
65
  when Rentlinx::Company
62
- raise Rentlinx::InvalidObject, object unless object.valid?
63
66
  post_company(object)
64
67
  when Rentlinx::Property
65
- raise Rentlinx::InvalidObject, object unless object.valid?
66
68
  post_property(object)
67
69
  when Rentlinx::Unit
68
- raise Rentlinx::InvalidObject, object unless object.valid?
69
70
  post_unit(object)
71
+ when Rentlinx::Lead
72
+ post_lead(object)
70
73
  else
71
74
  raise TypeError, "Type not permitted: #{object.class}"
72
75
  end
@@ -0,0 +1,9 @@
1
+ module Rentlinx
2
+ # An object that represets Rentlinx Leads
3
+ class Lead < Base
4
+ ATTRIBUTES = [:leadID, :refunded, :refund_reason]
5
+ REQUIRED_ATTRIBUTES = [:leadID, :refunded, :refund_reason]
6
+
7
+ attr_accessor(*ATTRIBUTES)
8
+ end
9
+ end
@@ -0,0 +1,11 @@
1
+ module Rentlinx
2
+ # Client methods for leads
3
+ module LeadClientMethods
4
+ private
5
+
6
+ def post_lead(lead)
7
+ return false unless lead.valid?
8
+ request('PUT', "leads/#{lead.leadID}", lead.to_hash)
9
+ end
10
+ end
11
+ end
@@ -1,5 +1,5 @@
1
1
  # This is the main rentlinx module. All Rentlinx objects
2
2
  # and methods are namespaced under this module.
3
3
  module Rentlinx
4
- VERSION = '0.9.5'
4
+ VERSION = '0.9.6'
5
5
  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.9.5
4
+ version: 0.9.6
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-11-23 00:00:00.000000000 Z
11
+ date: 2016-01-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httpclient
@@ -66,6 +66,7 @@ files:
66
66
  - lib/rentlinx/errors.rb
67
67
  - lib/rentlinx/models/base.rb
68
68
  - lib/rentlinx/models/company.rb
69
+ - lib/rentlinx/models/lead.rb
69
70
  - lib/rentlinx/models/property.rb
70
71
  - lib/rentlinx/models/property_amenity.rb
71
72
  - lib/rentlinx/models/property_link.rb
@@ -77,6 +78,7 @@ files:
77
78
  - lib/rentlinx/modules/amenity_client_methods.rb
78
79
  - lib/rentlinx/modules/amenityable.rb
79
80
  - lib/rentlinx/modules/company_client_methods.rb
81
+ - lib/rentlinx/modules/lead_client_methods.rb
80
82
  - lib/rentlinx/modules/link_client_methods.rb
81
83
  - lib/rentlinx/modules/linkable.rb
82
84
  - lib/rentlinx/modules/photo_client_methods.rb
@@ -113,7 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
113
115
  version: '0'
114
116
  requirements: []
115
117
  rubyforge_project:
116
- rubygems_version: 2.4.5.1
118
+ rubygems_version: 2.4.3
117
119
  signing_key:
118
120
  specification_version: 4
119
121
  summary: API Wrapper for the Rentlinx API