A thin async Scala client for FedEx’s Ship Service API
Scala
Switch branches/tags
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
project
src
.gitignore
.travis.yml
LICENSE
README.md
ShipService_v17.wsdl
build.sbt
gen.sh

README.md

scala-fedex

A thin async Scala client for FedEx’s Ship Service SOAP API.

Build Status GitHub version

scala-fedex reduces the boilerplate and verbosity of generated code from the Ship Service WSDL. It provides a nice abstraction and cleaner example of usage than the Java sample code on FedEx’s site 🌸 👍

Usage

Add it to your build.sbt

"com.gilt" %% "scala-fedex" % "0.0.4"

Create a new client and process a shipment

// Create a client instance
val fedexClient = new FedexClient(key, password, accountNumber, meterNumber)

// Process shipments
val result: Future[ProcessShipmentReply] = fedexClient.processShipment(requestedShipment)

Testing

There’s one automated spec FedexClientSpec.scala. This will call FedEx’s API and do a basic check of the label. The test needs environment variables defined for your FedEx test credentials. You can obtain these by registering on FedEx’s developer portal.

# Export your password, key, meter number, and account number
export FEDEX_PASSWORD="............."
export FEDEX_KEY=".................."
export FEDEX_METER_NUMBER="........."
export FEDEX_ACCOUNT_NUMBER="......."

You can also save and check the writing of the label by setting the environment variable FUNCTIONAL_TEST="true"

# Will write out a label to test-label-${trackingNumber}.pdf in the local directory
export FUNCTIONAL_TEST="true"
# Run our test to create a label
sbt clean test

Models

This project’s FedEx models are generated using scalaxb and FedEx’s Ship Service WSDL version 17. To regenerate the models run the gen script.

./gen.sh

Publish

git tag X.X.X
git push --tags
sbt publish