corelogic-ruby 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +9 -0
- data/.irbrc +7 -0
- data/.rspec +2 -0
- data/.ruby-version +1 -0
- data/.travis.yml +20 -0
- data/Gemfile +4 -0
- data/LICENSE +21 -0
- data/README.md +78 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/corelogic-ruby.gemspec +38 -0
- data/lib/corelogic.rb +54 -0
- data/lib/corelogic/api/properties_repository.rb +101 -0
- data/lib/corelogic/authenticator.rb +35 -0
- data/lib/corelogic/collection.rb +32 -0
- data/lib/corelogic/connection.rb +31 -0
- data/lib/corelogic/error.rb +39 -0
- data/lib/corelogic/property.rb +102 -0
- data/lib/corelogic/property/building.rb +74 -0
- data/lib/corelogic/property/last_market_sale.rb +42 -0
- data/lib/corelogic/property/location.rb +34 -0
- data/lib/corelogic/property/owner_transfer.rb +23 -0
- data/lib/corelogic/property/ownership.rb +30 -0
- data/lib/corelogic/property/prior_sale.rb +24 -0
- data/lib/corelogic/property/site.rb +35 -0
- data/lib/corelogic/property/tax_assessment.rb +48 -0
- data/lib/corelogic/response_parser.rb +27 -0
- data/lib/corelogic/utils.rb +30 -0
- data/lib/corelogic/version.rb +3 -0
- metadata +244 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d64a6a6de5da35dbe231663e765e9d58a8de995b
|
4
|
+
data.tar.gz: 4dbe83c9ffa651b4145cb514d7416ea9d0a85aab
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 01c1c781e2658c3b48dcdd0a401c1d49afe27b0e45a6655eeb8697af15f431af79a7f21bb0c5bf56dedbbb55b05e2611854e9e72ee630d9498d1c3aef8b6b006
|
7
|
+
data.tar.gz: a80a16eb6a23362443960b26ce058bd03f81124695795bee4b2078ee1c65d60e8912aac867a0b1660583ae6ea16ed97a9e31c15f83e4e7e918610c653e986741
|
data/.gitignore
ADDED
data/.irbrc
ADDED
data/.rspec
ADDED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.4.1
|
data/.travis.yml
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
sudo: false
|
2
|
+
env:
|
3
|
+
global:
|
4
|
+
- CC_TEST_REPORTER_ID=7d35e8f9ec6302498cfa3d55dd4c1c2596420c0d8a99d4285e326434fcd2c033
|
5
|
+
language: ruby
|
6
|
+
rvm:
|
7
|
+
- 2.4.1
|
8
|
+
- 2.5
|
9
|
+
before_script:
|
10
|
+
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
11
|
+
- chmod +x ./cc-test-reporter
|
12
|
+
- ./cc-test-reporter before-build
|
13
|
+
script:
|
14
|
+
- bundle exec rspec
|
15
|
+
after_script:
|
16
|
+
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|
17
|
+
before_install: gem install bundler -v 1.13.6
|
18
|
+
branches:
|
19
|
+
only:
|
20
|
+
- master
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2018 JetRockets
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
[![Build Status](https://travis-ci.org/jetrockets/corelogic-ruby.svg?branch=master)](https://travis-ci.org/jetrockets/corelogic-ruby)
|
2
|
+
[![Test Coverage](https://api.codeclimate.com/v1/badges/92a2dbaed71a83277c63/test_coverage)](https://codeclimate.com/github/jetrockets/corelogic-ruby/test_coverage)
|
3
|
+
[![Maintainability](https://api.codeclimate.com/v1/badges/92a2dbaed71a83277c63/maintainability)](https://codeclimate.com/github/jetrockets/corelogic-ruby/maintainability)
|
4
|
+
|
5
|
+
|
6
|
+
# Corelogic
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
Add this line to your application's Gemfile:
|
11
|
+
|
12
|
+
```ruby
|
13
|
+
gem 'corelogic-ruby'
|
14
|
+
```
|
15
|
+
|
16
|
+
And then execute:
|
17
|
+
|
18
|
+
$ bundle
|
19
|
+
|
20
|
+
Or install it yourself as:
|
21
|
+
|
22
|
+
$ gem install corelogic-ruby
|
23
|
+
|
24
|
+
## Configuring Corelogic
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
Corelogic.configure(consumer_key: 'your_client_id', consumer_secret: 'your_client_secret')
|
28
|
+
```
|
29
|
+
Or alternatively:
|
30
|
+
```ruby
|
31
|
+
Corelogic.configure do |c|
|
32
|
+
c.consumer_key = 'your_client_id'
|
33
|
+
c.consumer_secret = 'your_client_secret'
|
34
|
+
end
|
35
|
+
```
|
36
|
+
## Usage
|
37
|
+
### Property Search
|
38
|
+
Search the CoreLogic database for a property based on the input address and returns a unique CoreLogic PropertyID for use in subsequent API calls for other CoreLogic Property Data. Requires address and either zip5 or city and state.
|
39
|
+
For example:
|
40
|
+
```ruby
|
41
|
+
result = Corelogic::Property.search(zip5: 'target_zip', address: 'target_address')
|
42
|
+
```
|
43
|
+
If the properties are found, the `result` will contain an array of `Corelogic::Property` objects.
|
44
|
+
|
45
|
+
Otherwise, if nothing is found, search returns `Corelogic::Error::NotFound: No records returned from search`
|
46
|
+
|
47
|
+
### Property data
|
48
|
+
Get Property data by CoreLogic PropertyID.
|
49
|
+
For example:
|
50
|
+
````ruby
|
51
|
+
property = Corelogic::Property.new(corelogicPropertyId: 'someCorelogicPropertyId')
|
52
|
+
|
53
|
+
````
|
54
|
+
#### Property Ownership
|
55
|
+
Get detailed property ownership data based on an input CoreLogic PropertyID.
|
56
|
+
```ruby
|
57
|
+
property.ownership
|
58
|
+
=> #<Corelogic::Property::Ownership:0x007fe422132460 ...>
|
59
|
+
```
|
60
|
+
#### Following methods are provided for an `Corelogic::Property` instance.
|
61
|
+
#ownership
|
62
|
+
#building
|
63
|
+
#tax_assessment
|
64
|
+
#site
|
65
|
+
#location
|
66
|
+
#owner_transfer
|
67
|
+
#last_market_sale
|
68
|
+
#prior_sale
|
69
|
+
#load_details
|
70
|
+
|
71
|
+
## Contributing
|
72
|
+
|
73
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/jetrockets/corelogic-ruby.
|
74
|
+
|
75
|
+
## License
|
76
|
+
|
77
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
78
|
+
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "corelogic"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'corelogic/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "corelogic-ruby"
|
8
|
+
spec.version = Corelogic::VERSION
|
9
|
+
spec.authors = ["Ilia Kriachkov"]
|
10
|
+
spec.email = ["ilia.kriachkov@jetrockets.ru"]
|
11
|
+
|
12
|
+
spec.summary = "Ruby wrapper for the CoreLogic Property API"
|
13
|
+
spec.description = "Ruby wrapper for the CoreLogic Property API. http://developer.corelogic.com/"
|
14
|
+
spec.homepage = "https://github.com/jetrockets/corelogic-ruby"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.executables = `git ls-files -- bin/*`.split("\n").map { |f| File.basename(f) }
|
18
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
19
|
+
spec.bindir = "bin"
|
20
|
+
|
21
|
+
spec.require_paths = ["lib"]
|
22
|
+
spec.required_ruby_version = '~> 2.3'
|
23
|
+
|
24
|
+
# a b c d e f g h i j k l m n o p q r s t u v w x y z
|
25
|
+
spec.add_dependency 'dry-auto_inject'
|
26
|
+
spec.add_dependency 'dry-container'
|
27
|
+
spec.add_dependency 'dry-initializer'
|
28
|
+
spec.add_dependency 'http', '~> 3.0'
|
29
|
+
|
30
|
+
spec.add_development_dependency 'bundler', '~> 1.13'
|
31
|
+
spec.add_development_dependency 'factory_bot'
|
32
|
+
spec.add_development_dependency 'faker'
|
33
|
+
spec.add_development_dependency 'pry'
|
34
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
35
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
36
|
+
spec.add_development_dependency 'simplecov', '>= 0.6.2'
|
37
|
+
spec.add_development_dependency 'webmock'
|
38
|
+
end
|
data/lib/corelogic.rb
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
require "dry-container"
|
2
|
+
require "dry-auto_inject"
|
3
|
+
require "ostruct"
|
4
|
+
|
5
|
+
require "corelogic/connection"
|
6
|
+
require "corelogic/authenticator"
|
7
|
+
require "corelogic/response_parser"
|
8
|
+
require "corelogic/property"
|
9
|
+
require "corelogic/version"
|
10
|
+
|
11
|
+
module Corelogic
|
12
|
+
class << self
|
13
|
+
def configure(options = {})
|
14
|
+
options.each do |key, value|
|
15
|
+
configuration.send(:[]=, key, value)
|
16
|
+
end
|
17
|
+
yield(configuration) if block_given?
|
18
|
+
|
19
|
+
register!
|
20
|
+
end
|
21
|
+
|
22
|
+
def properties
|
23
|
+
Corelogic::API::PropertiesRepository.new
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def register!
|
29
|
+
connection = ::Corelogic::Connection.new
|
30
|
+
authenticator = ::Corelogic::Authenticator.new(configuration.to_h)
|
31
|
+
parser_class = ::Corelogic::ResponseParser
|
32
|
+
container.register :authenticator, -> { authenticator }
|
33
|
+
container.register :connection, -> { connection }
|
34
|
+
container.register :response_parser, -> { parser_class }
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
@@container = ::Dry::Container.new
|
41
|
+
|
42
|
+
AutoInject = ::Dry::AutoInject(@@container)
|
43
|
+
|
44
|
+
def self.container
|
45
|
+
@@container
|
46
|
+
end
|
47
|
+
|
48
|
+
def self.configuration
|
49
|
+
@@configuration ||= ::OpenStruct.new
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
require "corelogic/api/properties_repository"
|
54
|
+
|
@@ -0,0 +1,101 @@
|
|
1
|
+
require "corelogic/response_parser"
|
2
|
+
require "corelogic/collection"
|
3
|
+
require "corelogic/property"
|
4
|
+
require "corelogic/property/ownership"
|
5
|
+
require "corelogic/property/building"
|
6
|
+
require "corelogic/property/tax_assessment"
|
7
|
+
require "corelogic/property/site"
|
8
|
+
require "corelogic/property/location"
|
9
|
+
require "corelogic/property/owner_transfer"
|
10
|
+
require "corelogic/property/last_market_sale"
|
11
|
+
require "corelogic/property/prior_sale"
|
12
|
+
|
13
|
+
module Corelogic
|
14
|
+
module API
|
15
|
+
class PropertiesRepository
|
16
|
+
include Corelogic::AutoInject["connection"]
|
17
|
+
include Corelogic::AutoInject["response_parser"]
|
18
|
+
include Corelogic::AutoInject["authenticator"]
|
19
|
+
|
20
|
+
SEARCH_PATH = 'property'
|
21
|
+
|
22
|
+
def search(options = {})
|
23
|
+
Corelogic::Collection.new(Corelogic::Property, perform_response(SEARCH_PATH, options))
|
24
|
+
end
|
25
|
+
|
26
|
+
def ownership(property_id)
|
27
|
+
Property::Ownership.new(perform_response("property/#{property_id}/ownership"))
|
28
|
+
end
|
29
|
+
|
30
|
+
def building(property_id)
|
31
|
+
Property::Building.new(perform_response("property/#{property_id}/building"))
|
32
|
+
end
|
33
|
+
|
34
|
+
def tax_assessment(property_id)
|
35
|
+
Property::TaxAssessment.new(perform_response("property/#{property_id}/tax-assessment"))
|
36
|
+
end
|
37
|
+
|
38
|
+
def site(property_id)
|
39
|
+
Property::Site.new(perform_response("property/#{property_id}/site"))
|
40
|
+
end
|
41
|
+
|
42
|
+
def location(property_id)
|
43
|
+
Property::Location.new(perform_response("property/#{property_id}/location"))
|
44
|
+
end
|
45
|
+
|
46
|
+
def owner_transfer(property_id)
|
47
|
+
Property::OwnerTransfer.new(perform_response("property/#{property_id}/owner-transfer"))
|
48
|
+
end
|
49
|
+
|
50
|
+
def last_market_sale(property_id)
|
51
|
+
Property::LastMarketSale.new(perform_response("property/#{property_id}/last-market-sale"))
|
52
|
+
end
|
53
|
+
|
54
|
+
def prior_sale(property_id)
|
55
|
+
Property::PriorSale.new(perform_response("property/#{property_id}/prior-sale"))
|
56
|
+
end
|
57
|
+
|
58
|
+
def property_detail(property)
|
59
|
+
response = perform_response("property/#{property.id}/property-detail")
|
60
|
+
|
61
|
+
property.ownership = Property::Ownership.new(response[:ownership]) if response[:ownership]
|
62
|
+
property.building = Property::Building.new(response[:building]) if response[:building]
|
63
|
+
property.tax_assessment = Property::TaxAssessment.new(response[:taxAssessment]) if response[:taxAssessment]
|
64
|
+
property.site = Property::Site.new(response[:site]) if response[:site]
|
65
|
+
property.location = Property::Location.new(response[:location]) if response[:location]
|
66
|
+
property.owner_transfer = Property::OwnerTransfer.new(response[:ownerTransfer]) if response[:ownerTransfer]
|
67
|
+
property.last_market_sale = Property::LastMarketSale.new(response[:lastMarketSale]) if response[:lastMarketSale]
|
68
|
+
property.prior_sale = Property::PriorSale.new(response[:priorSale]) if response[:priorSale]
|
69
|
+
property
|
70
|
+
end
|
71
|
+
|
72
|
+
private
|
73
|
+
|
74
|
+
def perform_response(path, options = {})
|
75
|
+
try = 0
|
76
|
+
begin
|
77
|
+
try += 1
|
78
|
+
response_parser.perform(perform_get(path, options))
|
79
|
+
rescue Corelogic::Error::Unauthorized => e
|
80
|
+
puts e.message
|
81
|
+
if try < 2
|
82
|
+
puts "Retry: #{try}" if ENV['RAILS_ENV'] && ENV['RAILS_ENV'] == 'development'
|
83
|
+
perform_connection(true)
|
84
|
+
retry
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
def perform_get(path, options = {})
|
90
|
+
perform_connection.get(path, params: options)
|
91
|
+
end
|
92
|
+
|
93
|
+
def perform_connection(force = false)
|
94
|
+
return authenticator.call(connection, force: true) if force
|
95
|
+
return connection if connection.authenticated?
|
96
|
+
authenticator.call(connection)
|
97
|
+
end
|
98
|
+
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'http'
|
2
|
+
require 'dry-initializer'
|
3
|
+
require "corelogic/response_parser"
|
4
|
+
|
5
|
+
module Corelogic
|
6
|
+
class Authenticator
|
7
|
+
extend Dry::Initializer
|
8
|
+
|
9
|
+
OAUTH_URL = 'https://api-prod.corelogic.com/oauth/token'.freeze
|
10
|
+
|
11
|
+
option :consumer_key
|
12
|
+
option :consumer_secret
|
13
|
+
|
14
|
+
def call(connection, options = {})
|
15
|
+
options = options.dup
|
16
|
+
options[:grant_type] ||= 'client_credentials'
|
17
|
+
force = options.delete(:force) || false
|
18
|
+
return connection if !force && connection.authenticated?
|
19
|
+
|
20
|
+
response = HTTP.basic_auth(credentials).post(OAUTH_URL, params: options)
|
21
|
+
token = Corelogic::ResponseParser.perform(response)[:access_token]
|
22
|
+
connection.bearer_token = token
|
23
|
+
connection
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def credentials
|
29
|
+
{
|
30
|
+
user: consumer_key,
|
31
|
+
pass: consumer_secret
|
32
|
+
}
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module Corelogic
|
2
|
+
class Collection
|
3
|
+
extend Forwardable
|
4
|
+
def_delegators :@members, *[].public_methods
|
5
|
+
|
6
|
+
DEFAULT_RECORDS_LIMIT = 10
|
7
|
+
attr_reader :members, :klass, :raw_hash, :total_pages, :current_page, :limit_value, :total_records
|
8
|
+
|
9
|
+
def initialize(klass, raw_hash)
|
10
|
+
@klass = klass.is_a?(::String) ? ::Object.const_get(klass) : klass
|
11
|
+
@raw_hash = raw_hash
|
12
|
+
|
13
|
+
@total_pages = raw_hash[:totalPages] || 1
|
14
|
+
@current_page = raw_hash[:pageNumber] || 1
|
15
|
+
@limit_value = raw_hash[:pageSize] || DEFAULT_RECORDS_LIMIT
|
16
|
+
@total_records = raw_hash[:totalRecords]
|
17
|
+
|
18
|
+
if !@raw_hash[:data].nil? && !@raw_hash[:data].empty?
|
19
|
+
@members = @raw_hash[:data].map do |record|
|
20
|
+
@klass.new(record)
|
21
|
+
end
|
22
|
+
else
|
23
|
+
@members = []
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def to_a
|
28
|
+
@members
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'http'
|
2
|
+
|
3
|
+
module Corelogic
|
4
|
+
class Connection
|
5
|
+
attr_accessor :bearer_token
|
6
|
+
|
7
|
+
def initialize(options = {})
|
8
|
+
@bearer_token = options[:bearer_token]
|
9
|
+
end
|
10
|
+
|
11
|
+
BASE_PATH = 'https://api-prod.corelogic.com/'.freeze
|
12
|
+
|
13
|
+
def get(path, params = {})
|
14
|
+
HTTP.auth(bearer_auth_header).get(url(path), params)
|
15
|
+
end
|
16
|
+
|
17
|
+
def authenticated?
|
18
|
+
!(bearer_token.nil? || bearer_token.empty?)
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def bearer_auth_header
|
24
|
+
"Bearer #{bearer_token}"
|
25
|
+
end
|
26
|
+
|
27
|
+
def url(path)
|
28
|
+
URI.join(BASE_PATH, path)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module Corelogic
|
2
|
+
class Error < StandardError
|
3
|
+
attr_reader :code
|
4
|
+
|
5
|
+
BadRequest = Class.new(self)
|
6
|
+
Unauthorized = Class.new(self)
|
7
|
+
Forbidden = Class.new(self)
|
8
|
+
NotFound = Class.new(self)
|
9
|
+
InternalServerError = Class.new(self)
|
10
|
+
TooManyRequests = Class.new(self)
|
11
|
+
|
12
|
+
ERRORS_MAP = {
|
13
|
+
400 => Corelogic::Error::BadRequest,
|
14
|
+
401 => Corelogic::Error::Unauthorized,
|
15
|
+
403 => Corelogic::Error::Forbidden,
|
16
|
+
404 => Corelogic::Error::NotFound,
|
17
|
+
429 => Corelogic::Error::TooManyRequests,
|
18
|
+
500 => Corelogic::Error::InternalServerError
|
19
|
+
}.freeze
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def self.from_response(body)
|
24
|
+
message, status = parse_error(body)
|
25
|
+
new(message, status)
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.parse_error(body)
|
29
|
+
message = body.fetch(:message, nil) || body.fetch(:fault, {}).fetch(:faultstring, nil)
|
30
|
+
status = body.fetch(:status, nil) || body.fetch(:fault, {}).fetch(:detail, {}).fetch(:errorcode, nil)
|
31
|
+
return message, status
|
32
|
+
end
|
33
|
+
|
34
|
+
def initialize(message = '', code = nil)
|
35
|
+
super(message)
|
36
|
+
@code = code
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,102 @@
|
|
1
|
+
require 'dry-initializer'
|
2
|
+
|
3
|
+
module Corelogic
|
4
|
+
class Property
|
5
|
+
extend Dry::Initializer
|
6
|
+
|
7
|
+
option :corelogicPropertyId, as: :id
|
8
|
+
option :compositePropertyId, as: :composite_id, optional: true
|
9
|
+
option :streetAddress, proc(&:to_s), as: :street_address, optional: true
|
10
|
+
option :houseNumber, proc(&:to_s), as: :house_number, optional: true
|
11
|
+
option :houseNumber2, proc(&:to_s), as: :house_number2, optional: true
|
12
|
+
option :preDirection, proc(&:to_s), as: :pre_direction, optional: true
|
13
|
+
option :streetName, proc(&:to_s), as: :street_name, optional: true
|
14
|
+
option :streetSuffix, proc(&:to_s), as: :street_suffix, optional: true
|
15
|
+
option :postDirection, proc(&:to_s), as: :post_direction, optional: true
|
16
|
+
option :unitNumber, proc(&:to_s), as: :unit_number, optional: true
|
17
|
+
option :city, proc(&:to_s), optional: true
|
18
|
+
option :zipcode, proc(&:to_s), optional: true
|
19
|
+
option :zip4, proc(&:to_s), optional: true
|
20
|
+
option :state, proc(&:to_s), optional: true
|
21
|
+
option :latitude, proc(&:to_f), optional: true
|
22
|
+
option :longitude, proc(&:to_f), optional: true
|
23
|
+
option :fipsCode, proc(&:to_s), as: :fips_code, optional: true
|
24
|
+
option :parcelNumber, proc(&:to_s), as: :parcel_number, optional: true
|
25
|
+
option :parcelSequence, proc(&:to_s), as: :parcel_sequence, optional: true
|
26
|
+
option :carrierRoute, proc(&:to_s), as: :carrier_route, optional: true
|
27
|
+
option :links, optional: true
|
28
|
+
|
29
|
+
def self.search(options)
|
30
|
+
Corelogic.properties.search(options)
|
31
|
+
end
|
32
|
+
|
33
|
+
def ownership
|
34
|
+
@ownership ||= Corelogic.properties.ownership(self.id)
|
35
|
+
end
|
36
|
+
|
37
|
+
def ownership=(v)
|
38
|
+
@ownership = v
|
39
|
+
end
|
40
|
+
|
41
|
+
def building
|
42
|
+
@building ||= Corelogic.properties.building(self.id)
|
43
|
+
end
|
44
|
+
|
45
|
+
def building=(v)
|
46
|
+
@building = v
|
47
|
+
end
|
48
|
+
|
49
|
+
def tax_assessment
|
50
|
+
@tax_assessment ||= Corelogic.properties.tax_assessment(self.id)
|
51
|
+
end
|
52
|
+
|
53
|
+
def tax_assessment=(v)
|
54
|
+
@tax_assessment = v
|
55
|
+
end
|
56
|
+
|
57
|
+
def site
|
58
|
+
@site ||= Corelogic.properties.site(self.id)
|
59
|
+
end
|
60
|
+
|
61
|
+
def site=(v)
|
62
|
+
@site = v
|
63
|
+
end
|
64
|
+
|
65
|
+
def location
|
66
|
+
@location ||= Corelogic.properties.location(self.id)
|
67
|
+
end
|
68
|
+
|
69
|
+
def location=(v)
|
70
|
+
@location = v
|
71
|
+
end
|
72
|
+
|
73
|
+
def owner_transfer
|
74
|
+
@owner_transfer ||= Corelogic.properties.owner_transfer(self.id)
|
75
|
+
end
|
76
|
+
|
77
|
+
def owner_transfer=(v)
|
78
|
+
@owner_transfer = v
|
79
|
+
end
|
80
|
+
|
81
|
+
def last_market_sale
|
82
|
+
@last_market_sale ||= Corelogic.properties.last_market_sale(self.id)
|
83
|
+
end
|
84
|
+
|
85
|
+
def last_market_sale=(v)
|
86
|
+
@last_market_sale = v
|
87
|
+
end
|
88
|
+
|
89
|
+
def prior_sale
|
90
|
+
@prior_sale ||= Corelogic.properties.prior_sale(self.id)
|
91
|
+
end
|
92
|
+
|
93
|
+
def prior_sale=(v)
|
94
|
+
@prior_sale = v
|
95
|
+
end
|
96
|
+
|
97
|
+
def load_details
|
98
|
+
@details ||= Corelogic.properties.property_detail(self)
|
99
|
+
end
|
100
|
+
|
101
|
+
end
|
102
|
+
end
|
@@ -0,0 +1,74 @@
|
|
1
|
+
require 'dry-initializer'
|
2
|
+
|
3
|
+
module Corelogic
|
4
|
+
class Property::Building
|
5
|
+
extend Dry::Initializer
|
6
|
+
|
7
|
+
option :corelogicPropertyId, proc(&:to_s), as: :corelogic_property_id
|
8
|
+
option :compositePropertyId, proc(&:to_s), as: :composite_property_id, optional: true
|
9
|
+
option :stories, proc(&:to_i), as: :stories, optional: true
|
10
|
+
option :secondFloorArea, proc(&:to_i), as: :second_floor_area, optional: true
|
11
|
+
option :thirdFloorArea, proc(&:to_i), as: :third_floor_area, optional: true
|
12
|
+
option :aboveGradeArea, proc(&:to_i), as: :above_grade_area, optional: true
|
13
|
+
option :additionArea, proc(&:to_i), as: :addition_area, optional: true
|
14
|
+
option :airConditioning, proc(&:to_s), as: :air_conditioning, optional: true
|
15
|
+
option :attic, proc(&:to_s), as: :attic, optional: true
|
16
|
+
option :mainArea, proc(&:to_i), as: :main_area, optional: true
|
17
|
+
option :basementArea, proc(&:to_i), as: :basement_area, optional: true
|
18
|
+
option :basementFinish, proc(&:to_s), as: :basement_finish, optional: true
|
19
|
+
option :basementType, proc(&:to_s), as: :basement_type, optional: true
|
20
|
+
option :fullBaths, proc(&:to_s), as: :full_baths, optional: true
|
21
|
+
option :halfBaths, proc(&:to_s), as: :half_baths, optional: true
|
22
|
+
option :bedrooms, proc(&:to_s), as: :bedrooms, optional: true
|
23
|
+
option :buildingComments, proc(&:to_s), as: :building_comments, optional: true
|
24
|
+
option :carportArea, proc(&:to_i), as: :carport_area, optional: true
|
25
|
+
option :condition, proc(&:to_s), as: :condition, optional: true
|
26
|
+
option :constructionType, proc(&:to_s), as: :construction_type, optional: true
|
27
|
+
option :exteriorWall, proc(&:to_s), as: :exterior_wall, optional: true
|
28
|
+
option :finishedBasementArea, proc(&:to_i), as: :finished_basement_area, optional: true
|
29
|
+
option :fireplace, proc(&:to_s), as: :fireplace, optional: true
|
30
|
+
option :fireplaceType, proc(&:to_s), as: :fireplace_type, optional: true
|
31
|
+
option :floorCoverCode, proc(&:to_s), as: :floor_cover_code, optional: true
|
32
|
+
option :flooring, proc(&:to_s), as: :flooring, optional: true
|
33
|
+
option :foundation, proc(&:to_s), as: :foundation, optional: true
|
34
|
+
option :garage2Area, proc(&:to_i), as: :garage_2_area, optional: true
|
35
|
+
option :garageArea, proc(&:to_i), as: :garage_area, optional: true
|
36
|
+
option :garageCapacity, proc(&:to_s), as: :garage_capacity, optional: true
|
37
|
+
option :grossArea, proc(&:to_i), as: :gross_area, optional: true
|
38
|
+
option :groundFloorArea, proc(&:to_i), as: :ground_floor_area, optional: true
|
39
|
+
option :heatingFuelCode, proc(&:to_s), as: :heating_fuel_code, optional: true
|
40
|
+
option :heatType, proc(&:to_s), as: :heat_type, optional: true
|
41
|
+
option :interiorWallCode, proc(&:to_s), as: :interior_wall_code, optional: true
|
42
|
+
option :livingArea, proc(&:to_i), as: :living_area, optional: true
|
43
|
+
option :otherImprovements, proc(&:to_s), as: :other_improvements, optional: true
|
44
|
+
option :otherRooms, proc(&:to_s), as: :other_rooms, optional: true
|
45
|
+
option :parcelComments, proc(&:to_s), as: :parcel_comments, optional: true
|
46
|
+
option :parcelFuel, proc(&:to_s), as: :parcel_fuel, optional: true
|
47
|
+
option :parkingSpaces, proc(&:to_s), as: :parking_spaces, optional: true
|
48
|
+
option :parkingType, proc(&:to_s), as: :parking_type, optional: true
|
49
|
+
option :patio1Area, proc(&:to_i), as: :patio1_area, optional: true
|
50
|
+
option :patioType, proc(&:to_s), as: :patio_type, optional: true
|
51
|
+
option :pool, proc(&:to_s), as: :pool, optional: true
|
52
|
+
option :poolArea, proc(&:to_i), as: :pool_area, optional: true
|
53
|
+
option :porch1Area, proc(&:to_i), as: :porch_1_area, optional: true
|
54
|
+
option :porch2Area, proc(&:to_i), as: :porch_2_area, optional: true
|
55
|
+
option :porchCode, proc(&:to_s), as: :porch_code, optional: true
|
56
|
+
option :quality, proc(&:to_s), as: :quality, optional: true
|
57
|
+
option :rentableArea, proc(&:to_i), as: :rentable_area, optional: true
|
58
|
+
option :roofFrameCode, proc(&:to_s), as: :roof_frame_code, optional: true
|
59
|
+
option :roofShapeCode, proc(&:to_s), as: :roof_shape_code, optional: true
|
60
|
+
option :roofMaterialType, proc(&:to_s), as: :roof_material_type, optional: true
|
61
|
+
option :roofTypeCode, proc(&:to_s), as: :roof_type_code, optional: true
|
62
|
+
option :style, proc(&:to_s), as: :style, optional: true
|
63
|
+
option :totalBuildingArea, proc(&:to_i), as: :total_building_area, optional: true
|
64
|
+
option :totalAdjustedLivingArea, proc(&:to_i), as: :total_adjusted_living_area, optional: true
|
65
|
+
option :totalBaths, proc(&:to_i), as: :total_baths, optional: true
|
66
|
+
option :totalBathFixtures, proc(&:to_i), as: :total_bath_fixtures, optional: true
|
67
|
+
option :totalRooms, proc(&:to_i), as: :total_rooms, optional: true
|
68
|
+
option :upperArea, proc(&:to_i), as: :upper_area, optional: true
|
69
|
+
option :yearBuilt, proc(&:to_i), as: :year_built, optional: true
|
70
|
+
option :effectiveYearBuilt, proc(&:to_i), as: :effective_year_built, optional: true
|
71
|
+
option :fireplaceCount, proc(&:to_i), as: :fireplace_count, optional: true
|
72
|
+
option :links, optional: true
|
73
|
+
end
|
74
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'dry-initializer'
|
2
|
+
|
3
|
+
module Corelogic
|
4
|
+
class Property::LastMarketSale
|
5
|
+
extend Dry::Initializer
|
6
|
+
|
7
|
+
option :corelogicPropertyId, proc(&:to_s), as: :corelogic_property_id
|
8
|
+
option :compositePropertyId, proc(&:to_s), as: :composite_property_id, optional: true
|
9
|
+
option :firstMortgageAmount, proc(&:to_i), as: :first_mortgage_amount, optional: true
|
10
|
+
option :firstMortgageLoanType, proc(&:to_s), as: :first_mortgage_loan_type, optional: true
|
11
|
+
option :firstMortgageInterestRate, proc(&:to_f), as: :first_mortgage_interest_rate, optional: true
|
12
|
+
option :firstMortgageInterestRateType, proc(&:to_s), as: :first_mortgage_interest_rate_type, optional: true
|
13
|
+
option :secondMortgageAmount, proc(&:to_i), as: :second_mortgage_amount, optional: true
|
14
|
+
option :secondMortgageAmountType, proc(&:to_s), as: :second_mortgage_amount_type, optional: true
|
15
|
+
option :secondMortgageInterestRate, proc(&:to_f), as: :second_mortgage_interest_rate, optional: true
|
16
|
+
option :secondMortgageInterestRateType, proc(&:to_s), as: :second_mortgage_interest_rate_type, optional: true
|
17
|
+
option :actualSalePrice, proc(&:to_i), as: :actual_sale_price, optional: true
|
18
|
+
option :cashDown, proc(&:to_s), as: :cash_down, optional: true
|
19
|
+
option :deedType, proc(&:to_s), as: :deed_type, optional: true
|
20
|
+
option :documentNumber, proc(&:to_s), as: :document_number, optional: true
|
21
|
+
option :hawaiiCombinedSalePrice, proc(&:to_i), as: :hawaii_combined_sale_price, optional: true
|
22
|
+
option :mortgageDocumentNumber, proc(&:to_s), as: :mortgage_document_number, optional: true
|
23
|
+
option :firstMortgageLenderCode, proc(&:to_s), as: :first_mortgage_lender_code, optional: true
|
24
|
+
option :altDocumentNumber, proc(&:to_s), as: :alt_document_number, optional: true
|
25
|
+
option :altDocumentNumber2, proc(&:to_s), as: :alt_document_number2, optional: true
|
26
|
+
option :partialInterest, proc(&:to_s), as: :partial_interest, optional: true
|
27
|
+
option :ownerName1, proc(&:to_s), as: :owner_name1, optional: true
|
28
|
+
option :ownerName2, proc(&:to_s), as: :owner_name2, optional: true
|
29
|
+
option :pricePerSquareFoot, proc(&:to_f), as: :price_per_square_foot, optional: true
|
30
|
+
option :recordingDate, proc(&:to_s), as: :recording_date, optional: true
|
31
|
+
option :saleDate, proc(&:to_s), as: :sale_date, optional: true
|
32
|
+
option :saleType, proc(&:to_s), as: :sale_type, optional: true
|
33
|
+
option :multipleOrSplitCode, proc(&:to_s), as: :multiple_or_split_code, optional: true
|
34
|
+
option :sellerName, proc(&:to_s), as: :seller_name, optional: true
|
35
|
+
option :titleCompany, proc(&:to_s), as: :title_company, optional: true
|
36
|
+
option :transferDocumentNumber, proc(&:to_s), as: :transfer_document_number, optional: true
|
37
|
+
option :newConstruction, proc(&:to_s), as: :new_construction, optional: true
|
38
|
+
option :salePrice, proc(&:to_i), as: :sale_price, optional: true
|
39
|
+
option :lender, proc(&:to_s), as: :lender, optional: true
|
40
|
+
option :links, optional: true
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'dry-initializer'
|
2
|
+
|
3
|
+
module Corelogic
|
4
|
+
class Property::Location
|
5
|
+
extend Dry::Initializer
|
6
|
+
|
7
|
+
option :corelogicPropertyId, proc(&:to_s), as: :corelogic_property_id
|
8
|
+
option :compositePropertyId, proc(&:to_s), as: :composite_property_id, optional: true
|
9
|
+
option :alternateApn, proc(&:to_s), as: :alternate_apn, optional: true
|
10
|
+
option :apn, proc(&:to_s), as: :apn, optional: true
|
11
|
+
option :censusBlock, proc(&:to_s), as: :census_block, optional: true
|
12
|
+
option :county, proc(&:to_s), as: :county, optional: true
|
13
|
+
option :legalBlock, proc(&:to_s), as: :legal_block, optional: true
|
14
|
+
option :legalDescription, proc(&:to_s), as: :legal_description, optional: true
|
15
|
+
option :legalLot, proc(&:to_s), as: :legal_lot, optional: true
|
16
|
+
option :legalBookPage, proc(&:to_s), as: :legal_book_page, optional: true
|
17
|
+
option :mapReference1, proc(&:to_s), as: :map_reference1, optional: true
|
18
|
+
option :mapReference2, proc(&:to_s), as: :map_reference2, optional: true
|
19
|
+
option :marketArea, proc(&:to_s), as: :market_area, optional: true
|
20
|
+
option :neighborhoodCode, proc(&:to_s), as: :neighborhood_code, optional: true
|
21
|
+
option :state, proc(&:to_s), as: :state, optional: true
|
22
|
+
option :schoolDistrict, proc(&:to_s), as: :school_district, optional: true
|
23
|
+
option :subdivision, proc(&:to_s), as: :subdivision, optional: true
|
24
|
+
option :township, proc(&:to_s), as: :township, optional: true
|
25
|
+
option :townshipRangeSection, proc(&:to_s), as: :township_range_section, optional: true
|
26
|
+
option :censusTract, proc(&:to_s), as: :census_tract, optional: true
|
27
|
+
option :tractNumber, proc(&:to_s), as: :tract_number, optional: true
|
28
|
+
option :schoolDistrictName, proc(&:to_s), as: :school_district_name, optional: true
|
29
|
+
option :censusBlockGroup, proc(&:to_s), as: :census_block_group, optional: true
|
30
|
+
option :municipalityName, proc(&:to_s), as: :municipality_name, optional: true
|
31
|
+
option :neighborhood, proc(&:to_s), as: :neighborhood, optional: true
|
32
|
+
option :links, optional: true
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'dry-initializer'
|
2
|
+
|
3
|
+
module Corelogic
|
4
|
+
class Property::OwnerTransfer
|
5
|
+
extend Dry::Initializer
|
6
|
+
|
7
|
+
option :corelogicPropertyId, proc(&:to_s), as: :corelogic_property_id
|
8
|
+
option :compositePropertyId, proc(&:to_s), as: :composite_property_id, optional: true
|
9
|
+
option :recordingDate, proc(&:to_s), as: :recording_date, optional: true
|
10
|
+
option :saleDate, proc(&:to_s), as: :sale_date, optional: true
|
11
|
+
option :salePrice, proc(&:to_i), as: :sale_price, optional: true
|
12
|
+
option :documentNumber, proc(&:to_s), as: :document_number, optional: true
|
13
|
+
option :deedType, proc(&:to_s), as: :deed_type, optional: true
|
14
|
+
option :firstMortgageDocumentNumber, proc(&:to_s), as: :first_mortgage_document_number, optional: true
|
15
|
+
option :ownerName1, proc(&:to_s), as: :owner_name1, optional: true
|
16
|
+
option :ownerName2, proc(&:to_s), as: :owner_name2, optional: true
|
17
|
+
option :landCourtNumber, proc(&:to_s), as: :land_court_number, optional: true
|
18
|
+
option :multiSplit, proc(&:to_s), as: :multi_split, optional: true
|
19
|
+
option :partialInterest, proc(&:to_s), as: :partial_interest, optional: true
|
20
|
+
option :nominalMortgageDocumentNumber, proc(&:to_s), as: :nominal_mortgage_document_number, optional: true
|
21
|
+
option :links, optional: true
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'dry-initializer'
|
2
|
+
|
3
|
+
module Corelogic
|
4
|
+
class Property::Ownership
|
5
|
+
extend Dry::Initializer
|
6
|
+
option :corelogicPropertyId, proc(&:to_s), as: :corelogic_property_id
|
7
|
+
option :compositePropertyId, proc(&:to_s), as: :composite_property_id, optional: true
|
8
|
+
option :ownerName1, proc(&:to_s), as: :owner_name1, optional: true
|
9
|
+
option :ownerName2, proc(&:to_s), as: :owner_name2, optional: true
|
10
|
+
option :vestingOwner1, proc(&:to_s), as: :vesting_owner1, optional: true
|
11
|
+
option :vestingOwner2, proc(&:to_s), as: :vesting_owner2, optional: true
|
12
|
+
option :vestingOwner3, proc(&:to_s), as: :vesting_owner3, optional: true
|
13
|
+
option :vestingOwner4, proc(&:to_s), as: :vesting_owner4, optional: true
|
14
|
+
option :mailingAddress, proc(&:to_s), as: :mailing_address, optional: true
|
15
|
+
option :mailingCityState, proc(&:to_s), as: :mailing_city_state, optional: true
|
16
|
+
option :mailingZip5, proc(&:to_s), as: :mailing_zip5, optional: true
|
17
|
+
option :mailingZip4, proc(&:to_s), as: :mailing_zip4, optional: true
|
18
|
+
option :mailingCarrierRoute, proc(&:to_s), as: :mailing_carrier_route, optional: true
|
19
|
+
option :mailingCareOfName, proc(&:to_s), as: :mailing_care_of_name, optional: true
|
20
|
+
option :phoneNumber, proc(&:to_s), as: :phone_number, optional: true
|
21
|
+
option :vestingEtal, proc(&:to_s), as: :vesting_etal, optional: true
|
22
|
+
option :vestingOwnershipRight, proc(&:to_s), as: :vesting_ownership_right, optional: true
|
23
|
+
option :ownerOccupiedInd, proc(&:to_s), as: :owner_occupied_ind, optional: true
|
24
|
+
option :pendingRecordInd, proc(&:to_s), as: :pending_record_ind, optional: true
|
25
|
+
option :corporateOwner, proc(&:to_s), as: :corporate_owner, optional: true
|
26
|
+
option :ownerVestingCode, proc(&:to_s), as: :owner_vesting_code, optional: true
|
27
|
+
option :links, optional: true
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'dry-initializer'
|
2
|
+
|
3
|
+
module Corelogic
|
4
|
+
class Property::PriorSale
|
5
|
+
extend Dry::Initializer
|
6
|
+
|
7
|
+
option :corelogicPropertyId, proc(&:to_s), as: :corelogic_property_id
|
8
|
+
option :compositePropertyId, proc(&:to_s), as: :composite_property_id, optional: true
|
9
|
+
option :documentNumber, proc(&:to_s), as: :document_number, optional: true
|
10
|
+
option :documentType, proc(&:to_s), as: :document_type, optional: true
|
11
|
+
option :lenderNameCode, proc(&:to_s), as: :lender_name_code, optional: true
|
12
|
+
option :saleDate, proc(&:to_s), as: :sale_date, optional: true
|
13
|
+
option :salePrice, proc(&:to_i), as: :sale_price, optional: true
|
14
|
+
option :saleTypeCode1, proc(&:to_s), as: :sale_type_code1, optional: true
|
15
|
+
option :saleTypeCode2, proc(&:to_s), as: :sale_type_code2, optional: true
|
16
|
+
option :stampAmount, proc(&:to_s), as: :stamp_amount, optional: true
|
17
|
+
option :recordingDate, proc(&:to_s), as: :recording_date, optional: true
|
18
|
+
option :firstMortgageAmount, proc(&:to_i), as: :first_mortgage_amount, optional: true
|
19
|
+
option :firstMortgageType, proc(&:to_s), as: :first_mortgage_type, optional: true
|
20
|
+
option :firstMortgageInterestRate, proc(&:to_f), as: :first_mortgage_interest_rate, optional: true
|
21
|
+
option :firstMortgageInterestRateType, proc(&:to_s), as: :first_mortgage_interest_rate_type, optional: true
|
22
|
+
option :links, optional: true
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'dry-initializer'
|
2
|
+
|
3
|
+
module Corelogic
|
4
|
+
class Property::Site
|
5
|
+
extend Dry::Initializer
|
6
|
+
|
7
|
+
option :corelogicPropertyId, proc(&:to_s), as: :corelogic_property_id
|
8
|
+
option :compositePropertyId, proc(&:to_s), as: :composite_property_id, optional: true
|
9
|
+
option :acres, proc(&:to_f), as: :acres, optional: true
|
10
|
+
option :buildingClass, proc(&:to_s), as: :building_class, optional: true
|
11
|
+
option :buildingDepth, proc(&:to_s), as: :building_depth, optional: true
|
12
|
+
option :buildingWidth, proc(&:to_s), as: :building_width, optional: true
|
13
|
+
option :commercialUnits, proc(&:to_s), as: :commercial_units, optional: true
|
14
|
+
option :countyUseCode, proc(&:to_s), as: :county_use_code, optional: true
|
15
|
+
option :landUse, proc(&:to_s), as: :land_use, optional: true
|
16
|
+
option :lotSquareFeet, proc(&:to_i), as: :lot_square_feet, optional: true
|
17
|
+
option :lotDepth, proc(&:to_s), as: :lot_depth, optional: true
|
18
|
+
option :lotShape, proc(&:to_s), as: :lot_shape, optional: true
|
19
|
+
option :lotWidth, proc(&:to_s), as: :lot_width, optional: true
|
20
|
+
option :numberOfBuildings, proc(&:to_i), as: :number_of_buildings, optional: true
|
21
|
+
option :residentialUnits, proc(&:to_i), as: :residential_units, optional: true
|
22
|
+
option :sewerType, proc(&:to_s), as: :sewer_type, optional: true
|
23
|
+
option :siteInfluence, proc(&:to_s), as: :site_influence, optional: true
|
24
|
+
option :stateLandUse, proc(&:to_s), as: :state_land_use, optional: true
|
25
|
+
option :topography, proc(&:to_s), as: :topography, optional: true
|
26
|
+
option :usableLotArea, proc(&:to_s), as: :usable_lot_area, optional: true
|
27
|
+
option :water, proc(&:to_s), as: :water, optional: true
|
28
|
+
option :waterDistrict, proc(&:to_s), as: :water_district, optional: true
|
29
|
+
option :zoning, proc(&:to_s), as: :zoning, optional: true
|
30
|
+
option :stateLandUseCode, proc(&:to_s), as: :state_land_use_code, optional: true
|
31
|
+
option :zoningCode, proc(&:to_s), as: :zoning_code, optional: true
|
32
|
+
option :countyUse, proc(&:to_s), as: :county_use, optional: true
|
33
|
+
option :links, optional: true
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'dry-initializer'
|
2
|
+
|
3
|
+
module Corelogic
|
4
|
+
class Property::TaxAssessment
|
5
|
+
extend Dry::Initializer
|
6
|
+
|
7
|
+
option :corelogicPropertyId, proc(&:to_s), as: :corelogic_property_id
|
8
|
+
option :compositePropertyId, proc(&:to_s), as: :composite_property_id, optional: true
|
9
|
+
option :propertyTax, proc(&:to_s), as: :property_tax, optional: true
|
10
|
+
option :totalAssessedValue, proc(&:to_s), as: :total_assessed_value, optional: true
|
11
|
+
option :totalTaxableValue, proc(&:to_s), as: :total_taxable_value, optional: true
|
12
|
+
option :landAssessment, proc(&:to_s), as: :land_assessment, optional: true
|
13
|
+
option :improvementValue, proc(&:to_s), as: :improvement_value, optional: true
|
14
|
+
option :marketValue, proc(&:to_s), as: :market_value, optional: true
|
15
|
+
option :assessmentValue, proc(&:to_s), as: :assessment_value, optional: true
|
16
|
+
option :taxYear, proc(&:to_s), as: :tax_year, optional: true
|
17
|
+
option :equalizationRate, proc(&:to_s), as: :equalization_rate, optional: true
|
18
|
+
option :delinquentYear, proc(&:to_s), as: :delinquent_year, optional: true
|
19
|
+
option :taxAreaCode, proc(&:to_s), as: :tax_area_code, optional: true
|
20
|
+
option :miscExemption, proc(&:to_s), as: :misc_exemption, optional: true
|
21
|
+
option :seniorExemption, proc(&:to_s), as: :senior_exemption, optional: true
|
22
|
+
option :disabledExemption, proc(&:to_s), as: :disabled_exemption, optional: true
|
23
|
+
option :homesteadExemption, proc(&:to_s), as: :homestead_exemption, optional: true
|
24
|
+
option :veteransExemption, proc(&:to_s), as: :veterans_exemption, optional: true
|
25
|
+
option :widowExemption, proc(&:to_s), as: :widow_exemption, optional: true
|
26
|
+
option :taxExemptAmount, proc(&:to_s), as: :tax_exempt_amount, optional: true
|
27
|
+
option :fireDistrict, proc(&:to_s), as: :fire_district, optional: true
|
28
|
+
option :garbageDistrict, proc(&:to_s), as: :garbage_district, optional: true
|
29
|
+
option :lightUtilityDistrict, proc(&:to_s), as: :light_utility_district, optional: true
|
30
|
+
option :sewerDistrict, proc(&:to_s), as: :sewer_district, optional: true
|
31
|
+
option :waterDistrict, proc(&:to_s), as: :water_district, optional: true
|
32
|
+
option :taxAppraisalDistrict, proc(&:to_s), as: :tax_appraisal_district, optional: true
|
33
|
+
option :utilityDistrict, proc(&:to_s), as: :utility_district, optional: true
|
34
|
+
option :communityCollegeDistrict, proc(&:to_s), as: :community_college_district, optional: true
|
35
|
+
option :elementarySchoolDistrict, proc(&:to_s), as: :elementary_school_district, optional: true
|
36
|
+
option :schoolDistrictName, proc(&:to_s), as: :school_district_name, optional: true
|
37
|
+
option :sixthGradeSchoolDistrict, proc(&:to_s), as: :sixth_grade_school_district, optional: true
|
38
|
+
option :middleSchoolDistrict, proc(&:to_s), as: :middle_school_district, optional: true
|
39
|
+
option :highSchoolDistrict, proc(&:to_s), as: :high_school_district, optional: true
|
40
|
+
option :localTaxDistrict, proc(&:to_s), as: :local_tax_district, optional: true
|
41
|
+
option :improvedPercent, proc(&:to_s), as: :improved_percent, optional: true
|
42
|
+
option :propertyTaxAmount, proc(&:to_s), as: :property_tax_amount, optional: true
|
43
|
+
option :assessmentYear, proc(&:to_s), as: :assessment_year, optional: true
|
44
|
+
option :schoolDistrictCode, proc(&:to_s), as: :school_district_code, optional: true
|
45
|
+
option :taxExemptions, proc(&:to_s), as: :tax_exemptions, optional: true
|
46
|
+
option :links, optional: true
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require "corelogic/error"
|
2
|
+
require "corelogic/utils"
|
3
|
+
|
4
|
+
module Corelogic
|
5
|
+
class ResponseParser
|
6
|
+
class << self
|
7
|
+
def perform(response)
|
8
|
+
response_body = (response.body.nil? || response.body.empty?) ? '' : Corelogic::Utils.deep_symbolize_keys(response.parse(:json))
|
9
|
+
error_filter(response.code, response_body)
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def error(code, body)
|
15
|
+
klass = Corelogic::Error::ERRORS_MAP[code]
|
16
|
+
klass.from_response(body) unless klass.nil?
|
17
|
+
end
|
18
|
+
|
19
|
+
def error_filter(code, body)
|
20
|
+
error = error(code, body)
|
21
|
+
raise(error) if error
|
22
|
+
body
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
@@ -0,0 +1,30 @@
|
|
1
|
+
module Corelogic
|
2
|
+
module Utils
|
3
|
+
def validate_keys(hash, *required_keys)
|
4
|
+
received_keys = [required_keys].flatten - hash.keys
|
5
|
+
raise(ArgumentError, "Required key(s): #{received_keys.join(", ")}") unless received_keys.empty?
|
6
|
+
end
|
7
|
+
module_function :validate_keys
|
8
|
+
|
9
|
+
def deep_symbolize_keys(hash)
|
10
|
+
deep_transform_keys(hash) { |key| key.to_sym rescue key }
|
11
|
+
end
|
12
|
+
module_function :deep_symbolize_keys
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def deep_transform_keys(object, &block)
|
17
|
+
case object
|
18
|
+
when Hash
|
19
|
+
object.each_with_object({}) do |(key, value), result|
|
20
|
+
result[yield(key)] = deep_transform_keys(value, &block)
|
21
|
+
end
|
22
|
+
when Array
|
23
|
+
object.map { |e| deep_transform_keys(e, &block) }
|
24
|
+
else
|
25
|
+
object
|
26
|
+
end
|
27
|
+
end
|
28
|
+
module_function :deep_transform_keys
|
29
|
+
end
|
30
|
+
end
|
metadata
ADDED
@@ -0,0 +1,244 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: corelogic-ruby
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ilia Kriachkov
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-08-01 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: dry-auto_inject
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: dry-container
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: dry-initializer
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: http
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: bundler
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.13'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.13'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: factory_bot
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: faker
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: pry
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rake
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '10.0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '10.0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: rspec
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '3.0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '3.0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: simplecov
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: 0.6.2
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ">="
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: 0.6.2
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: webmock
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - ">="
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - ">="
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '0'
|
181
|
+
description: Ruby wrapper for the CoreLogic Property API. http://developer.corelogic.com/
|
182
|
+
email:
|
183
|
+
- ilia.kriachkov@jetrockets.ru
|
184
|
+
executables:
|
185
|
+
- console
|
186
|
+
- setup
|
187
|
+
extensions: []
|
188
|
+
extra_rdoc_files: []
|
189
|
+
files:
|
190
|
+
- ".gitignore"
|
191
|
+
- ".irbrc"
|
192
|
+
- ".rspec"
|
193
|
+
- ".ruby-version"
|
194
|
+
- ".travis.yml"
|
195
|
+
- Gemfile
|
196
|
+
- LICENSE
|
197
|
+
- README.md
|
198
|
+
- Rakefile
|
199
|
+
- bin/console
|
200
|
+
- bin/setup
|
201
|
+
- corelogic-ruby.gemspec
|
202
|
+
- lib/corelogic.rb
|
203
|
+
- lib/corelogic/api/properties_repository.rb
|
204
|
+
- lib/corelogic/authenticator.rb
|
205
|
+
- lib/corelogic/collection.rb
|
206
|
+
- lib/corelogic/connection.rb
|
207
|
+
- lib/corelogic/error.rb
|
208
|
+
- lib/corelogic/property.rb
|
209
|
+
- lib/corelogic/property/building.rb
|
210
|
+
- lib/corelogic/property/last_market_sale.rb
|
211
|
+
- lib/corelogic/property/location.rb
|
212
|
+
- lib/corelogic/property/owner_transfer.rb
|
213
|
+
- lib/corelogic/property/ownership.rb
|
214
|
+
- lib/corelogic/property/prior_sale.rb
|
215
|
+
- lib/corelogic/property/site.rb
|
216
|
+
- lib/corelogic/property/tax_assessment.rb
|
217
|
+
- lib/corelogic/response_parser.rb
|
218
|
+
- lib/corelogic/utils.rb
|
219
|
+
- lib/corelogic/version.rb
|
220
|
+
homepage: https://github.com/jetrockets/corelogic-ruby
|
221
|
+
licenses:
|
222
|
+
- MIT
|
223
|
+
metadata: {}
|
224
|
+
post_install_message:
|
225
|
+
rdoc_options: []
|
226
|
+
require_paths:
|
227
|
+
- lib
|
228
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
229
|
+
requirements:
|
230
|
+
- - "~>"
|
231
|
+
- !ruby/object:Gem::Version
|
232
|
+
version: '2.3'
|
233
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
234
|
+
requirements:
|
235
|
+
- - ">="
|
236
|
+
- !ruby/object:Gem::Version
|
237
|
+
version: '0'
|
238
|
+
requirements: []
|
239
|
+
rubyforge_project:
|
240
|
+
rubygems_version: 2.6.11
|
241
|
+
signing_key:
|
242
|
+
specification_version: 4
|
243
|
+
summary: Ruby wrapper for the CoreLogic Property API
|
244
|
+
test_files: []
|