rentlinx 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rentlinx/client.rb +1 -1
- data/lib/rentlinx/errors.rb +2 -2
- data/lib/rentlinx/models/base.rb +7 -9
- data/lib/rentlinx/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3b5b566cfebed779111d78efd37f82571407bf98
|
4
|
+
data.tar.gz: e941ff23098e8a4634836a0d7083fcaf3667185c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 799d668a581182b0a1d7204b964c8d4bfb405627442dda8de9771da23f18eea6ab19279c5673a1690855f5f44adcd5e77ffffcfd94e9f101f71b70f7dde04988
|
7
|
+
data.tar.gz: c65076091494c0da9eb34638f52fe660e4dcae8952c03acf8334267f74fa951dfa8d46361f14692b38129310137a1edaa6603f6d9530d701a22f9012c8bb1287
|
data/lib/rentlinx/client.rb
CHANGED
@@ -111,7 +111,7 @@ module Rentlinx
|
|
111
111
|
nil # don't attempt to JSON parse emptystring
|
112
112
|
when 400
|
113
113
|
body = JSON.parse(response.body)
|
114
|
-
raise Rentlinx::BadRequest, body['details']
|
114
|
+
raise Rentlinx::BadRequest, response, body['details']
|
115
115
|
when 403
|
116
116
|
raise Rentlinx::Forbidden, response
|
117
117
|
when 404
|
data/lib/rentlinx/errors.rb
CHANGED
@@ -30,8 +30,8 @@ module Rentlinx
|
|
30
30
|
end
|
31
31
|
|
32
32
|
class BadRequest < HTTPError
|
33
|
-
def initialize(response)
|
34
|
-
super(response, 'The request sent to the server was invalid.')
|
33
|
+
def initialize(response, message = nil)
|
34
|
+
super(response, message || 'The request sent to the server was invalid.')
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
data/lib/rentlinx/models/base.rb
CHANGED
@@ -49,21 +49,15 @@ module Rentlinx
|
|
49
49
|
end
|
50
50
|
|
51
51
|
def valid?
|
52
|
-
required_attributes.
|
53
|
-
!send(at).nil? && send(at) != ''
|
54
|
-
end
|
52
|
+
required_attributes.none? { |at| blank?(send(at)) }
|
55
53
|
end
|
56
54
|
|
57
55
|
def valid_for_post?
|
58
|
-
required_attributes_for_post.
|
59
|
-
!send(at).nil? && send(at) != ''
|
60
|
-
end
|
56
|
+
required_attributes_for_post.none? { |at| blank?(send(at)) }
|
61
57
|
end
|
62
58
|
|
63
59
|
def missing_attributes
|
64
|
-
missing = required_attributes.select
|
65
|
-
send(at).nil? || send(at) == ''
|
66
|
-
end
|
60
|
+
missing = required_attributes.select { |at| blank?(send(at)) }
|
67
61
|
|
68
62
|
"Missing required attributes: #{missing.join(', ')}"
|
69
63
|
end
|
@@ -77,5 +71,9 @@ module Rentlinx
|
|
77
71
|
def self.type
|
78
72
|
name.split('::').last.downcase.to_sym
|
79
73
|
end
|
74
|
+
|
75
|
+
def blank?(str)
|
76
|
+
str.nil? || str == ''
|
77
|
+
end
|
80
78
|
end
|
81
79
|
end
|
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.3.
|
4
|
+
version: 0.3.2
|
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-06-
|
11
|
+
date: 2015-06-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httpclient
|