alt 0.0.2 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4c95bf250ed92251331f64ee9538ab2389d02a846d9e18252ae74222f7c69dee
4
- data.tar.gz: 865437becd4108c1f0cd93d31ab804da714eb4677477c6faf023612a3a5200f1
3
+ metadata.gz: 563d2fc47056480cff9fa2d26ea4b281d217ac8d267815c82b70097d50b600b1
4
+ data.tar.gz: e329a3b293b1a192b127e4451f53b65b741917b1d421ab45813a268d81db68bd
5
5
  SHA512:
6
- metadata.gz: 45780d134aa7a48290183ad1b5b4ed5b433364256cf466666e50b333274fee54ec18002a49d3c4cd47fc3bc9daaab12ab226069a081d1575f4461e9c9f286e01
7
- data.tar.gz: a0711bdc3d3da14fe9d3704ec6b5c7e51c51435e84c10f8055531cb7e9f2043f4764a7de310363b6379d727c880fad24eadf6c6bdf5cb8cc5f262c033c55a559
6
+ metadata.gz: 8611ddf2d4bdf9f70888aebf8279d82ebeb10ed254676aa63735968340230ce0f7b1387344233badf57f6c9bf256628558cc9a053ddd9063104c761ca6600f01
7
+ data.tar.gz: f801ba6e3f41630923742bb836822c327a24e2ddd7c2af39cec0c5b2bcd555ad71e4bec77edbcec50bca1c579819edb96214156d85b3f0782d58ded3cd7ee862
data/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [1.0.0] - 2026-08-05
2
+
3
+ - Implement `Alt::Property#property_details`, which was previously a `# TODO` returning `nil`.
4
+ A lookup now issues two requests against RapidAPI's `realty-in-us` host: an
5
+ `/locations/v2/auto-complete` call to resolve the address to a property id, then a
6
+ `/properties/v3/detail` call for the details.
7
+
1
8
  ## [0.0.2] - 2026-07-28
2
9
 
3
10
  - Initial release
data/README.md CHANGED
@@ -1,20 +1,42 @@
1
- # HouseCanary API Ruby client
1
+ # Realtor API Ruby client
2
+
3
+ Fetches property details from Realtor, reached through
4
+ [RapidAPI](https://rapidapi.com/apidojo/api/realty-in-us).
2
5
 
3
6
  ## Authentication
4
7
 
5
- Generate an API key/secret in HouseCanary and set as environment variables:
8
+ Subscribe to the Realtor API on RapidAPI and set your key as an environment variable:
9
+
10
+ - `ENV['RAPIDAPI_KEY']`
6
11
 
7
- - `ENV['HOUSECANARY_API_KEY']`
8
- - `ENV['HOUSECANARY_API_SECRET']`
12
+ The host (`realty-in-us.p.rapidapi.com`) is sent automatically as `X-RapidAPI-Host`.
9
13
 
10
14
  ## Available methods
11
15
 
12
16
  ```ruby
13
17
  property = Alt::Property.new address: "4352 Desert Park Ave", unit: nil, city: "North Las Vegas", zipcode: "89085"
14
18
 
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"}
19
+ property.property_details # => the parsed `/properties/v3/detail` response body
20
+ ```
21
+
22
+ Unlike HouseCanary, which returns separate `subject_address`, `public_records` and
23
+ `assessment` objects, Realtor returns a single object, exposed here as `property_details`.
24
+
25
+ ## How a lookup works
26
+
27
+ Realtor has no address-to-detail endpoint, so a lookup takes two requests:
28
+
29
+ 1. `GET /locations/v2/auto-complete?input=<address>` — resolves the address to a property id
30
+ 2. `GET /properties/v3/detail?property_id=<id>` — returns the details
31
+
32
+ `Alt::Error` is raised when either request fails, or when the address matches no property.
33
+
34
+ ## Status
16
35
 
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"}
36
+ The two endpoint paths above are confirmed to exist. The following identifiers are **not yet
37
+ verified against a live response** (the account's RapidAPI quota was exhausted at the time of
38
+ writing) and should be checked against the RapidAPI playground before relying on this client:
18
39
 
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
- ```
40
+ - the `input` query parameter name for `/locations/v2/auto-complete`
41
+ - the `autocomplete` array and its `mpr_id` field in that response
42
+ - the `property_id` query parameter name for `/properties/v3/detail`
data/lib/alt/error.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Alt
2
- # An error to raise when HouseCanary API doesn't respond as expected.
2
+ # An error to raise when the Realtor API doesn't respond as expected.
3
3
  Error = Class.new(StandardError)
4
4
  end
data/lib/alt/property.rb CHANGED
@@ -1,9 +1,12 @@
1
- # A wrapper for the HouseCanary API to fetch public records about a property.
2
- # @see https://api-docs.housecanary.com/#tag/Property-Level/
1
+ # A wrapper for the Realtor API, reached through RapidAPI, to fetch property details.
2
+ # @see https://rapidapi.com/apidojo/api/realty-in-us
3
3
  module Alt
4
- # Embeds the logic of a HouseCanary property.
4
+ # Embeds the logic of a Realtor property.
5
5
  class Property
6
- # @data [Hash] data the attributes of each provider
6
+ # The RapidAPI host serving the Realtor data.
7
+ HOST = 'realty-in-us.p.rapidapi.com'
8
+
9
+ # @data [Hash] data the attributes of each property
7
10
  # @option data [String] address Building number, street name, and optionally unit number
8
11
  # @option data [String] unit Unit number for the property
9
12
  # @option data [String] city City in which the property is located
@@ -12,8 +15,8 @@ module Alt
12
15
  @data = data
13
16
  end
14
17
 
15
- # @return [Hash] Address information
16
- def property_details = details[:property_details]
18
+ # @return [Hash] Details about the property
19
+ def property_details = details
17
20
 
18
21
  private
19
22
 
@@ -21,8 +24,33 @@ module Alt
21
24
  @details ||= fetch
22
25
  end
23
26
 
24
- def fetch
25
- # TODO
27
+ # Realtor exposes no address-to-detail endpoint, so the address is resolved to an id first.
28
+ def fetch = get '/properties/v3/detail', property_id: property_id
29
+
30
+ def property_id
31
+ suggestions = get('/locations/v2/auto-complete', input: input)[:autocomplete]
32
+ raise Error if suggestions.nil? || suggestions.empty?
33
+
34
+ suggestions.first[:mpr_id]
35
+ end
36
+
37
+ def input
38
+ [@data[:address], @data[:unit], @data[:city], @data[:zipcode]]
39
+ .reject { |part| part.to_s.empty? }.join ' '
40
+ end
41
+
42
+ def get(path, params)
43
+ uri = URI "https://#{HOST}#{path}"
44
+ uri.query = URI.encode_www_form params
45
+
46
+ request = Net::HTTP::Get.new uri
47
+ request['X-RapidAPI-Key'] = ENV['RAPIDAPI_KEY']
48
+ request['X-RapidAPI-Host'] = HOST
49
+ response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
50
+ http.request(request)
51
+ end
52
+ raise Error unless response.is_a?(Net::HTTPSuccess)
53
+ JSON(response.body).with_indifferent_access
26
54
  end
27
55
  end
28
56
  end
data/lib/alt/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Alt
2
- VERSION = '0.0.2'
2
+ VERSION = '1.0.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Claudio Baccigalupo
@@ -58,7 +58,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
58
58
  - !ruby/object:Gem::Version
59
59
  version: '0'
60
60
  requirements: []
61
- rubygems_version: 4.0.3
61
+ rubygems_version: 4.0.10
62
62
  specification_version: 4
63
63
  summary: A Ruby client for the Realtor API.
64
64
  test_files: []