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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6aa97a327400aeff7f170786b69dc9e038371fdc
4
- data.tar.gz: a9e6258229b0676180be3e00e145113ec497e5c9
3
+ metadata.gz: 6945492920d30e62b769a7b4b3c89b1e26e7be10
4
+ data.tar.gz: 07f11c4486e4e142632277a28fffa4a0b1e33573
5
5
  SHA512:
6
- metadata.gz: e4d8666090d655e879232483fbdd74e84249937dc41d459719ead0a04a07a1e62581d85f497880eaaafcd5c9751e0186c93c02d4549d5e1f0a3418997a7b8c2d
7
- data.tar.gz: b117a9745b6e6bec1307cb5d31dddbdc0ca8e53312a0c45fb7e534fa585457b1d164a3fcb106d70bb6e6c0e85c1d277071d0cddf45c1ed916e63218cb36c8e13
6
+ metadata.gz: d72733d83b47e0bd1141b2c06d36d4ad19fe04e4e3b9d6469d8612211eb2a6ba8448a3fdf2adcc666cc2a2fa670d484a209db8f4fe4925a7f1ea4b6ba2342c83
7
+ data.tar.gz: 1cf99840f44b1c2f9ae1a86e99eddf16ec351cedddd7ee6c52c516542d2dd66330c06265dbac60435e367bcb5ae57637479b8ada6d4c2a71b11e5a7ba7b0a493
@@ -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
- body = JSON.parse(response.body)
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
@@ -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, message = nil)
40
- super(response, message || 'The request sent to the server was invalid.')
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)
@@ -0,0 +1,10 @@
1
+ module Rentlinx
2
+ class CityValidator < BaseValidator
3
+ private
4
+
5
+ def validate
6
+ return if !@value.nil? && @value.length > 2
7
+ @error = "'#{@value}' is not a valid city, a city must be 3 characters or more."
8
+ end
9
+ end
10
+ end
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Rentlinx
2
- VERSION = '0.8.2'
2
+ VERSION = '0.9.0'
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.8.2
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-10 00:00:00.000000000 Z
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.3
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: