Street Address Parser API - Ruby Gem
Street Address Parser is a simple tool for parsing a US street addresses. It returns the parsed components of the street address provided.
Installation
Add this line to your application's Gemfile:
gem 'apiverve_streetaddressparser'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install apiverve_streetaddressparser
Getting Started
Get your API key at APIVerve
Basic Usage
require 'apiverve_streetaddressparser'
# Initialize the client
client = APIVerve::Streetaddressparser::Client.new(api_key: "YOUR_API_KEY")
# Make a request
response = client.execute({ address: "1600 Amphitheatre Parkway, Mountain View, CA 90210" })
# Print the response
puts response
Error Handling
begin
response = client.execute({ address: "1600 Amphitheatre Parkway, Mountain View, CA 90210" })
puts response["data"]
rescue APIVerve::Streetaddressparser::ValidationError => e
puts "Validation error: #{e.errors.join(', ')}"
rescue APIVerve::Streetaddressparser::APIError => e
puts "API error: #{e.}"
puts "Status code: #{e.status_code}"
end
Debug Mode
# Enable debug logging
client = APIVerve::Streetaddressparser::Client.new(
api_key: "YOUR_API_KEY",
debug: true
)
Example Response
{
"status": "ok",
"error": null,
"data": {
"address": "1600 Amphitheatre Parkway, Mountain View, CA 90210",
"parsed": {
"streetNumber": "1600",
"streetType": "Pkwy",
"streetAddress": "Amphitheatre",
"cityName": "Mountain View",
"stateName": "CA",
"zipCode": "90210"
}
}
}
Documentation
For more information, visit the API Documentation.
Support
- Website: https://streetaddressparser.apiverve.com?utm_source=ruby&utm_medium=readme
- Email: hello@apiverve.com
License
This gem is available under the MIT License.