README.md in mainstreet-0.0.1 vs README.md in mainstreet-0.1.0
- old
+ new
@@ -2,30 +2,45 @@
A standard US address model for Rails
You get:
-- geocoding
-- standardization
- verification
+- standardization
+- geocoding
## How It Works
-[todo]
+```ruby
+Address.create!(street: "1 infinite loop", zip_code: "95014")
+```
+This creates an address with:
+
+- street - `1 Infinite Loop`
+- city - `Cupertino`
+- state - `CA`
+- zip_code - `95014`
+- latitude - `37.33053`
+- longitude - `-122.02887`
+- original_attributes - `{"street"=>"1 infinite loop", "street2"=>nil, "city"=>nil, "state"=>nil, "zip_code"=>"95014"}`
+- verification_info
+
### Verification
-MainStreet performs ZIP code verification by default.
+By default, MainStreet performs ZIP code verification.
```ruby
-address = Address.new(street: "400 bryant st", zip_code: "94108")
+address = Address.new(street:"1 infinite loop", zip_code: "95015")
address.valid?
# false
address.errors.full_messages
-# ["Did you mean 94107?"]
+# ["Did you mean 95014?"]
```
+For full verification, including unit number, [see below](#full-verification).
+
## Installation
Add this line to your application’s Gemfile:
```ruby
@@ -45,25 +60,23 @@
- city
- state
- zip_code
- latitude
- longitude
-- verification_info
- original_attributes
+- verification_info
To add to an existing model:
1. Use `alias_attribute` to map existing field names
-2. Add new fields like `verification_info` and `original_attributes`
+2. Add new fields like `original_attributes` and `verification_info`
3. Add `acts_as_address` to your model
-## Address Verification
+## Full Verification
-MainStreet does ZIP code verification by default.
+[SmartyStreets](https://smartystreets.com/features) is required for full verification. The free plan supports 250 lookups per month.
-For complete address verification, sign up for a [SmartyStreets](https://smartystreets.com/features) account. The free plan supports 250 lookups per month.
-
Set:
```ruby
ENV["SMARTY_STREETS_AUTH_ID"] = "auth-id"
ENV["SMARTY_STREETS_AUTH_TOKEN"] = "auth-token"
@@ -71,10 +84,11 @@
To test it, run:
```ruby
address = Address.new(street: "122 Mast Rd", zip_code: "03861")
-address.valid? # should get false
+address.valid?
+# should get false
```
## Contributing
Everyone is encouraged to help improve this project. Here are a few ways you can help: