hcn 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG.md +3 -0
- data/LICENSE.txt +21 -0
- data/README.md +20 -0
- data/lib/hcn/error.rb +4 -0
- data/lib/hcn/property.rb +43 -0
- data/lib/hcn/version.rb +3 -0
- data/lib/hcn.rb +9 -0
- metadata +64 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 5bae325675aa747f1fb056114e78231d497d22aa137f85fa930df446ad7dd1a7
|
|
4
|
+
data.tar.gz: 830a23955f011c28b6a25235dee408c417fd530a1d10ea732cb2698279da6aa3
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 82b6a9a17ec7e3ccccedb12c2e2629b0fc48b0a074d8cd8968b71453f95c897cb676f7c7fec6a17f605ce0f558e5e0c29d8f08879204e5e7f433b505fdca4833
|
|
7
|
+
data.tar.gz: 8b1db068010524f767a78874265e9fa55be76f374d3a0c550012c5236a9c9571efe1edbd8d5f9f291e07fe8437916760779d74988d7a8ce66b846a3479fcfa22
|
data/CHANGELOG.md
ADDED
data/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 HouseAccount
|
|
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
|
|
13
|
+
all 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
|
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# HouseCanary API Ruby client
|
|
2
|
+
|
|
3
|
+
## Authentication
|
|
4
|
+
|
|
5
|
+
Generate an API key/secret in HouseCanary and set as environment variables:
|
|
6
|
+
|
|
7
|
+
- `ENV['HOUSECANARY_API_KEY']`
|
|
8
|
+
- `ENV['HOUSECANARY_API_SECRET']`
|
|
9
|
+
|
|
10
|
+
## Available methods
|
|
11
|
+
|
|
12
|
+
```ruby
|
|
13
|
+
property = Hcn::Property.new address: "4352 Desert Park Ave", unit: nil, city: "North Las Vegas", zipcode: "89085"
|
|
14
|
+
|
|
15
|
+
property.subject_address # => {msa: "29820", city: "North Las Vegas", fips: "32003", slug: "4352-Desert-Park-Ave-North-Las-Vegas-NV-89085", unit: "", state: "NV", address: "4352 Desert Park Ave", zipcode: "89085", block_id: "320030036621009", latitude: 36.31164, longitude: -115.20045, address_id: 8412516, address_full: "4352 Desert Park Ave North Las Vegas NV 89085", geo_precision: "rooftop", zipcode_plus4: "2321"}
|
|
16
|
+
|
|
17
|
+
property.public_records # => {pool: nil, attic: nil, sewer: nil, water: nil, zoning: {code: nil, description: nil}, cooling: nil, heating: ["Forced Air Unit"], parking: {total: 2, garage: nil, description: "Built-in"}, stories: 2, basement: {has: nil, total_area: nil, finished_pct: nil}, bedrooms: 4, lot_size: 4792, bathrooms: {full: nil, total: nil, partial: nil, total_provided: 3.0, total_projected: 3}, buildings: nil, fireplace: true, parcel_id: "12407312060", roof_type: nil, year_built: 2007, living_area: 2778, rooms_total: 9, subdivision: nil, units_total: nil, neighborhood: nil, sewer_public: nil, solar_panels: nil, property_type: "SFR", roof_material: "Tile", pool_community: nil, building_quality: nil, fireplaces_total: 1, legal_description: "DIST:NLV CITY/MUNI/TWP:NORTH LAS VEGAS SEC/TWN/RNG/MER:SEC 07 TWN 19S RNG 61E GRAND TETON VALLEY N W 80 PUD-45 #2 PLAT BOOK 123 PAGE 68 LOT 129 MAP REF:PB B0123 P0068", construction_types: ["Frame"], architectural_style: nil, building_condition_code: "Average", living_area_above_grade: nil, living_area_below_grade: nil, walls_exterior_material: "Stucco", property_type_description: "Single Family Residential"}
|
|
18
|
+
|
|
19
|
+
property.assessment # => {apn: "124-07-312-060", tax_year: 2026, amount_annual: 2772.91, year_assessed: 2026, value_assessed: 150470, value_assessed_land: 35350, value_assessed_improvement: 115120}
|
|
20
|
+
```
|
data/lib/hcn/error.rb
ADDED
data/lib/hcn/property.rb
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# A wrapper for the HouseCanary API to fetch public records about a property.
|
|
2
|
+
# @see https://api-docs.housecanary.com/#tag/Property-Level/
|
|
3
|
+
module Hcn
|
|
4
|
+
# Embeds the logic of a HouseCanary property.
|
|
5
|
+
class Property
|
|
6
|
+
# @data [Hash] data the attributes of each provider
|
|
7
|
+
# @option data [String] address Building number, street name, and optionally unit number
|
|
8
|
+
# @option data [String] unit Unit number for the property
|
|
9
|
+
# @option data [String] city City in which the property is located
|
|
10
|
+
# @option data [String] zipcode 5-digit US zipcode in which the property is located
|
|
11
|
+
def initialize(data = {})
|
|
12
|
+
@data = data
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# @return [Hash] Address information
|
|
16
|
+
def subject_address = details[:subject_address]
|
|
17
|
+
|
|
18
|
+
# @return [Hash] Public Record information
|
|
19
|
+
def public_records = details[:public_records]
|
|
20
|
+
|
|
21
|
+
# @return [Hash] Details about the most recent assessment
|
|
22
|
+
def assessment = details[:assessment]
|
|
23
|
+
|
|
24
|
+
private
|
|
25
|
+
|
|
26
|
+
def details
|
|
27
|
+
@details ||= fetch
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def fetch
|
|
31
|
+
uri = URI 'https://api.housecanary.com/v3/property/details_advanced'
|
|
32
|
+
uri.query = URI.encode_www_form @data.merge(type: :public)
|
|
33
|
+
|
|
34
|
+
request = Net::HTTP::Get.new uri
|
|
35
|
+
request.basic_auth ENV['HOUSECANARY_API_KEY'], ENV['HOUSECANARY_API_SECRET']
|
|
36
|
+
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
|
|
37
|
+
http.request(request)
|
|
38
|
+
end
|
|
39
|
+
raise Error unless response.is_a?(Net::HTTPSuccess)
|
|
40
|
+
JSON(response.body).with_indifferent_access
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
end
|
data/lib/hcn/version.rb
ADDED
data/lib/hcn.rb
ADDED
metadata
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
|
2
|
+
name: hcn
|
|
3
|
+
version: !ruby/object:Gem::Version
|
|
4
|
+
version: 1.0.0
|
|
5
|
+
platform: ruby
|
|
6
|
+
authors:
|
|
7
|
+
- Claudio Baccigalupo
|
|
8
|
+
bindir: exe
|
|
9
|
+
cert_chain: []
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
11
|
+
dependencies:
|
|
12
|
+
- !ruby/object:Gem::Dependency
|
|
13
|
+
name: activesupport
|
|
14
|
+
requirement: !ruby/object:Gem::Requirement
|
|
15
|
+
requirements:
|
|
16
|
+
- - ">="
|
|
17
|
+
- !ruby/object:Gem::Version
|
|
18
|
+
version: '0'
|
|
19
|
+
type: :runtime
|
|
20
|
+
prerelease: false
|
|
21
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
22
|
+
requirements:
|
|
23
|
+
- - ">="
|
|
24
|
+
- !ruby/object:Gem::Version
|
|
25
|
+
version: '0'
|
|
26
|
+
description: Jobber API
|
|
27
|
+
email:
|
|
28
|
+
- claudiob@users.noreply.github.com
|
|
29
|
+
executables: []
|
|
30
|
+
extensions: []
|
|
31
|
+
extra_rdoc_files: []
|
|
32
|
+
files:
|
|
33
|
+
- CHANGELOG.md
|
|
34
|
+
- LICENSE.txt
|
|
35
|
+
- README.md
|
|
36
|
+
- lib/hcn.rb
|
|
37
|
+
- lib/hcn/error.rb
|
|
38
|
+
- lib/hcn/property.rb
|
|
39
|
+
- lib/hcn/version.rb
|
|
40
|
+
homepage: https://github.com/HouseAccountEng/hcn
|
|
41
|
+
licenses:
|
|
42
|
+
- MIT
|
|
43
|
+
metadata:
|
|
44
|
+
homepage_uri: https://github.com/HouseAccountEng/hcn
|
|
45
|
+
source_code_uri: https://github.com/HouseAccountEng/hcn
|
|
46
|
+
changelog_uri: https://github.com/HouseAccountEng/hcn
|
|
47
|
+
rdoc_options: []
|
|
48
|
+
require_paths:
|
|
49
|
+
- lib
|
|
50
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - ">="
|
|
53
|
+
- !ruby/object:Gem::Version
|
|
54
|
+
version: 3.2.0
|
|
55
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
56
|
+
requirements:
|
|
57
|
+
- - ">="
|
|
58
|
+
- !ruby/object:Gem::Version
|
|
59
|
+
version: '0'
|
|
60
|
+
requirements: []
|
|
61
|
+
rubygems_version: 4.0.3
|
|
62
|
+
specification_version: 4
|
|
63
|
+
summary: A Ruby client for the HouseCanary API.
|
|
64
|
+
test_files: []
|