purplship.domain package

Submodules

purplship.domain.client module

PurplShip Client base class definition

class purplship.domain.client.Client(server_url: str, carrier_name: str)

Bases: object

Unitied API carrier Client (Interface) …

server_url : str
a carrier server url address (can be test or prod)
carrier_name : str
a custom name to identified the carrier client instance (set to carrier name by default)

purplship.domain.interface module

Interface.

class purplship.domain.interface.IDeserialize(deserialize: Callable[S])

Bases: object

parse()
class purplship.domain.interface.IRequestFrom(action: Callable[purplship.domain.proxy.Proxy, purplship.domain.interface.IDeserialize])

Bases: object

from_(proxy: purplship.domain.proxy.Proxy) → purplship.domain.interface.IDeserialize
class purplship.domain.interface.IRequestWith(action: Callable[purplship.domain.proxy.Proxy, purplship.domain.interface.IDeserialize])

Bases: object

with_(proxy: purplship.domain.proxy.Proxy) → purplship.domain.interface.IDeserialize
class purplship.domain.interface.pickup

Bases: object

static book(args: Union[purplship.domain.Types.models.PickupRequest, dict])
static cancel(args: Union[purplship.domain.Types.models.PickupCancellationRequest, dict])
static update(args: Union[purplship.domain.Types.models.PickupRequest, dict])
class purplship.domain.interface.rating

Bases: object

static fetch(args: Union[purplship.domain.Types.models.RateRequest, dict])
class purplship.domain.interface.shipment

Bases: object

static create(args: Union[purplship.domain.Types.models.ShipmentRequest, dict])
class purplship.domain.interface.tracking

Bases: object

static fetch(args: Union[purplship.domain.Types.models.TrackingRequest, dict]) → purplship.domain.interface.IRequestFrom

purplship.domain.mapper module

PurplShip Mapper base class definition module.

class purplship.domain.mapper.Mapper

Bases: abc.ABC

United API to carrier data Mapper (Interface) …

client : Client
a carrier client (holding connection settings)
create_pickup_cancellation_request(payload: purplship.domain.Types.models.PickupCancellationRequest)

Create a carrier specific pickup cancellation request xml data from payload

create_pickup_request(payload: purplship.domain.Types.models.PickupRequest)

Create a carrier specific pickup request xml data from payload

create_quote_request(payload: purplship.domain.Types.models.RateRequest)

Create a carrier specific quote request xml data from payload

create_shipment_request(payload: purplship.domain.Types.models.ShipmentRequest)

Create a carrier specific shipment creation request xml data from payload

create_tracking_request(payload: purplship.domain.Types.models.TrackingRequest)

Create a carrier specific tracking request xml data from payload

modify_PickupRequest(payload: purplship.domain.Types.models.PickupRequest)

Create a carrier specific pickup modification request xml data from payload

parse_pickup_cancellation_response(response) → Tuple[dict, List[purplship.domain.Types.models.Error]]

Create a united API pickup cancellation result from carrier xml response

parse_pickup_response(response) → Tuple[purplship.domain.Types.models.PickupDetails, List[purplship.domain.Types.models.Error]]

Create a united API pickup result from carrier xml response

parse_quote_response(response) → Tuple[List[purplship.domain.Types.models.QuoteDetails], List[purplship.domain.Types.models.Error]]

Create a united API quote result list from carrier xml response

parse_shipment_response(response) → Tuple[purplship.domain.Types.models.ShipmentDetails, List[purplship.domain.Types.models.Error]]

Create a united API shipment creation result from carrier xml response

parse_tracking_response(response) → Tuple[List[purplship.domain.Types.models.TrackingDetails], List[purplship.domain.Types.models.Error]]

Create a united API tracking result list from carrier xml response

purplship.domain.proxy module

PurplShip Proxy base class definition module.

class purplship.domain.proxy.Proxy(client: purplship.domain.client.Client, mapper: purplship.domain.mapper.Mapper)

Bases: object

Unitied API carrier Proxy (Interface) …

client : Client
a carrier client (holding connection settings)
mapper : Mapper
a carrier mapper for specific carrier data type mapping
cancel_pickup(xmlObj)

export xmlObj as xml string and request pickup cancellation from carrier

create_shipment(xmlObj)

export xmlObj as xml string and request shipment creation from carrier

get_quotes(xmlObj)

export xmlObj as xml string and request quote from carrier

get_tracking(xmlObj)

export xmlObj as xml string and request tracking from carrier

modify_pickup(xmlObj)

export xmlObj as xml string and request pickup modification from carrier

request_pickup(xmlObj)

export xmlObj as xml string and request pickup from carrier

Module contents