rentlinx 0.8.2 → 0.9.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/client.rb +1 -2
- data/lib/rentlinx/errors.rb +10 -2
- data/lib/rentlinx/validators/attribute_processor_service.rb +4 -2
- data/lib/rentlinx/validators/city_validator.rb +10 -0
- data/lib/rentlinx/validators/zip_validator.rb +2 -2
- data/lib/rentlinx/version.rb +1 -1
- metadata +19 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6945492920d30e62b769a7b4b3c89b1e26e7be10
|
4
|
+
data.tar.gz: 07f11c4486e4e142632277a28fffa4a0b1e33573
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d72733d83b47e0bd1141b2c06d36d4ad19fe04e4e3b9d6469d8612211eb2a6ba8448a3fdf2adcc666cc2a2fa670d484a209db8f4fe4925a7f1ea4b6ba2342c83
|
7
|
+
data.tar.gz: 1cf99840f44b1c2f9ae1a86e99eddf16ec351cedddd7ee6c52c516542d2dd66330c06265dbac60435e367bcb5ae57637479b8ada6d4c2a71b11e5a7ba7b0a493
|
data/lib/rentlinx/client.rb
CHANGED
@@ -96,8 +96,7 @@ module Rentlinx
|
|
96
96
|
when 204
|
97
97
|
nil # don't attempt to JSON parse emptystring
|
98
98
|
when 400
|
99
|
-
|
100
|
-
raise Rentlinx::BadRequest, response, body['details']
|
99
|
+
raise Rentlinx::BadRequest, response
|
101
100
|
when 403
|
102
101
|
raise Rentlinx::Forbidden, response
|
103
102
|
when 404
|
data/lib/rentlinx/errors.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
1
3
|
module Rentlinx
|
2
4
|
class RentlinxError < StandardError
|
3
5
|
end
|
@@ -36,8 +38,14 @@ module Rentlinx
|
|
36
38
|
end
|
37
39
|
|
38
40
|
class BadRequest < HTTPError
|
39
|
-
def initialize(response
|
40
|
-
|
41
|
+
def initialize(response)
|
42
|
+
default_message = 'The request sent to the server was invalid.'
|
43
|
+
begin
|
44
|
+
message = JSON.parse(response.body)['details'] || default_message
|
45
|
+
rescue JSON::ParserError
|
46
|
+
message = default_message
|
47
|
+
end
|
48
|
+
super(response, message)
|
41
49
|
end
|
42
50
|
end
|
43
51
|
|
@@ -1,8 +1,9 @@
|
|
1
1
|
require 'rentlinx/validators/base_validator'
|
2
|
+
require 'rentlinx/validators/city_validator'
|
2
3
|
require 'rentlinx/validators/phone_validator'
|
3
4
|
require 'rentlinx/validators/state_validator'
|
4
|
-
require 'rentlinx/validators/zip_validator'
|
5
5
|
require 'rentlinx/validators/url_validator'
|
6
|
+
require 'rentlinx/validators/zip_validator'
|
6
7
|
|
7
8
|
module Rentlinx
|
8
9
|
class AttributeProcessor
|
@@ -19,7 +20,8 @@ module Rentlinx
|
|
19
20
|
validators = { phoneNumber: PhoneValidator,
|
20
21
|
state: StateValidator,
|
21
22
|
zip: ZipValidator,
|
22
|
-
leadsURL: UrlValidator
|
23
|
+
leadsURL: UrlValidator,
|
24
|
+
city: CityValidator }
|
23
25
|
|
24
26
|
@attrs.each do |field, val|
|
25
27
|
next unless validators.keys.include?(field)
|
@@ -3,8 +3,8 @@ module Rentlinx
|
|
3
3
|
private
|
4
4
|
|
5
5
|
def validate
|
6
|
-
return if value_blank? || @value.match(/^\d{5}$/)
|
7
|
-
@error = "#{@value} is not a valid zip code, zip codes must be five digits (93117)"
|
6
|
+
return if value_blank? || @value.match(/^\d{5}$|^\d{5}-\d{4}$/)
|
7
|
+
@error = "#{@value} is not a valid zip code, zip codes must be five digits (93117) or five digits, a dash, and four digits (93117-1234)"
|
8
8
|
end
|
9
9
|
end
|
10
10
|
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.
|
4
|
+
version: 0.9.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: 2015-09-
|
11
|
+
date: 2015-09-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httpclient
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '2.12'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: logging
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 2.0.0
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 2.0.0
|
55
69
|
description:
|
56
70
|
email: bryce.boe@appfolio.com
|
57
71
|
executables: []
|
@@ -83,6 +97,7 @@ files:
|
|
83
97
|
- lib/rentlinx/modules/unit_client_methods.rb
|
84
98
|
- lib/rentlinx/validators/attribute_processor_service.rb
|
85
99
|
- lib/rentlinx/validators/base_validator.rb
|
100
|
+
- lib/rentlinx/validators/city_validator.rb
|
86
101
|
- lib/rentlinx/validators/phone_validator.rb
|
87
102
|
- lib/rentlinx/validators/state_validator.rb
|
88
103
|
- lib/rentlinx/validators/url_validator.rb
|
@@ -108,8 +123,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
123
|
version: '0'
|
109
124
|
requirements: []
|
110
125
|
rubyforge_project:
|
111
|
-
rubygems_version: 2.4.
|
126
|
+
rubygems_version: 2.4.5.1
|
112
127
|
signing_key:
|
113
128
|
specification_version: 4
|
114
129
|
summary: API Wrapper for the Rentlinx API
|
115
130
|
test_files: []
|
131
|
+
has_rdoc:
|