diff --git a/CHANGES.rst b/CHANGES.rst index a744760..51f7419 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -3,8 +3,10 @@ Change Log 2.4.0 ----- + * Pickup Service usingv11 WSDL (hornedbull) -* TODO: Added examples, documentation and unit tests for Pickup Service. +* Added documentation and unit tests for Pickup Service. (radzhome) +* Update package data to include tools (noodlebreak) 2.3.1 ----- diff --git a/MANIFEST.in b/MANIFEST.in index feb9b2a..39bd3df 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -2,4 +2,5 @@ include LICENSE.txt include README.rst recursive-include examples *.txt *.py recursive-include docs * +recursive-include fedex/tools * recursive-include fedex/wsdl * \ No newline at end of file diff --git a/doc_src/release_notes.rst b/doc_src/release_notes.rst index e7181e6..cf88ac2 100755 --- a/doc_src/release_notes.rst +++ b/doc_src/release_notes.rst @@ -5,6 +5,13 @@ Change Log ========== +2.4.0 +----- + +* Pickup Service usingv11 WSDL (hornedbull) +* Added documentation and unit tests for Pickup Service. (radzhome) +* Update package data to include tools (noodlebreak) + 2.3.0 ----- diff --git a/doc_src/services.rst b/doc_src/services.rst index 89b21a9..5498c5b 100755 --- a/doc_src/services.rst +++ b/doc_src/services.rst @@ -65,6 +65,14 @@ Validates the postal codes for a given address. .. autoclass:: fedex.services.country_service.FedexValidatePostalRequest +Pickup Service +-------------- + +Creates a fedex pickup request. + +.. autoclass:: fedex.services.pickup_service.FedexCreatePickupRequest + + Package Movement Service ------------------------ diff --git a/epydoc_source/README.rst b/epydoc_source/README.rst index 641ba63..e42f2b3 100644 --- a/epydoc_source/README.rst +++ b/epydoc_source/README.rst @@ -8,4 +8,8 @@ using epydoc 3.0.1. The following was used to generate doc: epydoc -v -o 2.X.X ../fedex/ The epydoc documentation is hosted at https://pythonhosted.org/fedex/. -Latest documentation is now generated using Sphinx. + +Latest documentation is now generated using Sphinx. Updates can be made to the +*.rst files in doc_src: + + cd python-fedex/doc_src diff --git a/examples/create_pickup.py b/examples/create_pickup.py new file mode 100755 index 0000000..deb0bea --- /dev/null +++ b/examples/create_pickup.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python +""" +This example shows how to create a pickup request +""" +import datetime + +from example_config import CONFIG_OBJ +from fedex.services.pickup_service import FedexCreatePickupRequest + +customer_transaction_id = "*** PickupService Request v11 using Python ***" # Optional transaction_id +pickup_service = FedexCreatePickupRequest(CONFIG_OBJ, customer_transaction_id) + +pickup_service.OriginDetail.PickupLocation.Contact.PersonName = 'Sender Name' +pickup_service.OriginDetail.PickupLocation.Contact.EMailAddress = 'test@user.com' +pickup_service.OriginDetail.PickupLocation.Contact.CompanyName = 'Acme Inc.' +pickup_service.OriginDetail.PickupLocation.Contact.PhoneNumber = '9012638716' +pickup_service.OriginDetail.PickupLocation.Address.StateOrProvinceCode = 'SC' +pickup_service.OriginDetail.PickupLocation.Address.PostalCode = '29631' +pickup_service.OriginDetail.PickupLocation.Address.CountryCode = 'US' +pickup_service.OriginDetail.PickupLocation.Address.StreetLines = ['155 Old Greenville Hwy', 'Suite 103'] +pickup_service.OriginDetail.PickupLocation.Address.City = 'Clemson' +# pickup_service.OriginDetail.PickupLocation.Address.UrbanizationCode = '' # For Puerto Rico only +pickup_service.OriginDetail.PickupLocation.Address.Residential = False + +# FRONT, NONE, REAR, SIDE +# pickup_service.OriginDetail.PackageLocation = 'NONE' + +# APARTMENT, BUILDING, DEPARTMENT, FLOOR, ROOM, SUITE +# pickup_service.OriginDetail.BuildingPart = 'SUITE' + +# Identifies the date and time the package will be ready for pickup by FedEx. +pickup_service.OriginDetail.ReadyTimestamp = datetime.datetime.now().replace(microsecond=0).isoformat() + +# Identifies the latest time at which the driver can gain access to pick up the package(s) +pickup_service.OriginDetail.CompanyCloseTime = '23:00:00' + +pickup_service.CarrierCode = 'FDXE' + +pickup_service.TotalWeight.Units = 'LB' +pickup_service.TotalWeight.Value = '1' +pickup_service.PackageCount = '1' +# pickup_service.OversizePackageCount = '1' + +# pickup_service.CommodityDescription = '' + +# DOMESTIC or INTERNATIONAL +# pickup_service.CountryRelationship = 'DOMESTIC' + +# See PickupServiceCategoryType +# pickup_service.PickupServiceCategory = 'FEDEX_DISTANCE_DEFERRED' + +pickup_service.send_request() + +print pickup_service.response.HighestSeverity == 'SUCCESS' +print pickup_service.response.Notifications[0].Message diff --git a/fedex/__init__.py b/fedex/__init__.py index 19fd601..86a9165 100644 --- a/fedex/__init__.py +++ b/fedex/__init__.py @@ -52,4 +52,4 @@ our U{Github project} and enter an issue in the U{Issue Tracker}. """ -VERSION = __version__ = '2.3.1' +VERSION = __version__ = '2.4.0' diff --git a/setup.py b/setup.py index 8573170..395cd42 100755 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ 'Topic :: Software Development :: Libraries :: Python Modules' ] -KEYWORDS = 'fedex soap suds wrapper rate location ship service' +KEYWORDS = 'fedex soap suds wrapper rate track avs location ship pickup country availability commitment package service' setup(name='fedex', version=fedex.VERSION, @@ -27,7 +27,7 @@ download_url='http://pypi.python.org/pypi/fedex/', packages=['fedex', 'fedex.services', 'fedex.printers'], package_dir={'fedex': 'fedex'}, - package_data={'fedex': ['wsdl/*.wsdl', 'wsdl/test_server_wsdl/*.wsdl', 'tools/*.py']}, + package_data={'fedex': ['wsdl/*.wsdl', 'wsdl/test_server_wsdl/*.wsdl', 'tools/*']}, platforms=['Platform Independent'], license='BSD', classifiers=CLASSIFIERS, diff --git a/tests/test_pickup_service.py b/tests/test_pickup_service.py index 3baa4db..5dcc39c 100644 --- a/tests/test_pickup_service.py +++ b/tests/test_pickup_service.py @@ -22,11 +22,17 @@ @unittest.skipIf(not CONFIG_OBJ.account_number, "No credentials provided.") class FedexCreatePickupRequestTests(unittest.TestCase): """ - These tests verify that the rate service WSDL is in good shape. + These tests verify that the pikckup service WSDL is in good shape. """ - def test_rate(self): - pickup_service = FedexCreatePickupRequest(CONFIG_OBJ) + def setUp(self): + self.config_obj = get_fedex_config() + + def tearDown(self): + pass + + def test_pickup_request(self): + pickup_service = FedexCreatePickupRequest(self.config_obj) pickup_service.OriginDetail.PickupLocation.Contact.PersonName = 'Sender Name' pickup_service.OriginDetail.PickupLocation.Contact.EMailAddress = 'test@user.com'