Skip to content

Commit

Permalink
feat(us-autocompletions): add USAutocompletions
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyle Kwong committed May 18, 2018
1 parent 658d679 commit 056af8f
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 1 deletion.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ There are simple scripts to demonstrate how to create all the core Lob objects (
- [Verify a US Address](https://lob.com/docs/python#us_verifications_create)
- [The US ZIP Lookup Object](https://lob.com/docs/python#us_zip_lookups_object)
- [Lookup a US ZIP Code](https://lob.com/docs/python#us_zip_lookups_create)
- [US Autocompletion API](https://lob.com/docs/python#us_autocompletions)
- [The US Autocompletion Object](https://lob.com/docs/python#us_autocompletions_object)
- [Autocomplete a US Address](https://lob.com/docs/python#us_autocompletions_create)
- [The US Autocompletion Test Environment](https://lob.com/docs/python#us-autocompletions-test-environment)
- **Int'l Verification API**
- [International Verifications](https://lob.com/docs/python#intl_verifications)
- [Verify an International Address](https://lob.com/docs/python#intl_verifications_create)
Expand Down
3 changes: 2 additions & 1 deletion lob/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Resources
from lob.resource import (Address, Area, BankAccount, Check, Letter, Postcard,
Route, USVerification, USZipLookup, IntlVerification)
Route, USAutocompletion, USVerification, USZipLookup,
IntlVerification)

from lob.version import VERSION

Expand Down
4 changes: 4 additions & 0 deletions lob/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,10 @@ class Route(ListableAPIResource):
endpoint = '/routes'


class USAutocompletion(CreateableAPIResource):
endpoint = '/us_autocompletions'


class USVerification(CreateableAPIResource):
endpoint = '/us_verifications'

Expand Down
17 changes: 17 additions & 0 deletions tests/test_us_autocompletion.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import unittest
import lob


class TestUSAutocompletionFunctions(unittest.TestCase):
def setUp(self):
lob.api_key = 'test_fc26575412e92e22a926bc96c857f375f8b'

def test_us_autocompletion(self):
autocompletion = lob.USAutocompletion.create(
address_prefix='185 BER',
city='SAN FRANCISCO',
state='CA'
)

self.assertIn('suggestions', autocompletion)
self.assertEqual(autocompletion.suggestions[0].primary_line, 'TEST KEYS DO NOT AUTOCOMPLETE US ADDRESSES')

0 comments on commit 056af8f

Please sign in to comment.