Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #27 from EasyPost/add_user_carrier_account
Add user carrier account
- Loading branch information
Showing
7 changed files
with
100 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
2.0.15 | ||
2.0.16 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
VERSION = '2.0.15' | ||
VERSION = '2.0.16' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import easypost | ||
easypost.api_key = 'API KEY' | ||
|
||
original_num_cas = len(easypost.CarrierAccount.all()) | ||
|
||
created_ca = easypost.CarrierAccount.create( | ||
type="UpsAccount", | ||
description="A test Ups Account", | ||
reference="PythonClientUpsTestAccount", | ||
credentials={ | ||
"account_number": "A1A1A1", | ||
"user_id": "UPSDOTCOM_USERNAME", | ||
"password": "UPSDOTCOM_PASSWORD", | ||
"access_license_number": "UPS_ACCESS_LICENSE_NUMBER"}) | ||
|
||
caid = created_ca["id"] | ||
|
||
retrieved_ca = easypost.CarrierAccount.retrieve(caid) | ||
retrieved_ca.description = "An updated description for a test Ups Account" | ||
retrieved_ca.credentials = { | ||
"account_number": "B2B2B2B2", | ||
"user_id": "UPSDOTCOM_USERNAME", | ||
"password": "UPSDOTCOM_PASSWORD", | ||
"access_license_number": "UPS_ACCESS_LICENSE_NUMBER" | ||
} | ||
retrieved_ca.save() | ||
|
||
updated_ca = easypost.CarrierAccount.retrieve(caid) | ||
updated_ca.credentials["account_number"] = "C3C3C3C3C3" | ||
updated_ca.credentials["user_id"] = "A_NEW_UPS_USERNAME" | ||
updated_ca.save() | ||
|
||
reupdated_ca = easypost.CarrierAccount.retrieve(caid) | ||
|
||
# You can call save() with no unsaved changes, but it does nothing | ||
final_ca = reupdated_ca.save() | ||
|
||
final_ca.delete() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import easypost | ||
easypost.api_key = 'API KEY' | ||
|
||
types = easypost.CarrierAccount.types() | ||
|
||
for carrier_type in types: | ||
print carrier_type.type |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters