Skip to content

omnibus/ups API reference

Floor
Provider · Omnibus
Version
2.x
Conformance suite
runs, no CI read
Verified for real
Its README does not say
Licence
MIT
composer require omnibus/ups:2.x-dev

Read from the package's own PHP files at the commit 9748d2557b70: its namespaces, classes, interfaces and enums, their public constants, properties and methods with their PHPDoc, and the options its factories take. Nothing of it is run.

Omnibus\Ups

  • Api class

    UPS's REST APIs on an OAuth2 client-credentials token, kept until it expires.

    3 methods · 2 properties · 3 constants

  • Mapping class

    UPS's shapes for ours.

    3 methods · 1 constant

  • UpsGatewayFactory class

    options: client_id: '%env(UPS_CLIENT_ID)%' # an app in the UPS Developer Portal client_secret: '%env(UPS_CLIENT_SECRET)%' account_number: '%env(UPS_ACCOUNT)%' # the shipper account (6 characters) sandbox: true # the Customer Integration Environment rates: [...] # optional: prices from configuration instead of the Rating API

    9 options

Omnibus\Ups\Action

  • PickupAction class

    The Locator API: UPS Access Points near an address, nearest first.

    3 methods

  • RatingAction class

    The Rating API's Shop: every service UPS can carry the shipment with, priced.

    3 methods

  • ShippingAction class

    The Shipping API: the shipment booked, its label (PDF by default, "GIF"/"ZPL" through the option label_format).

    3 methods

  • TrackingAction class

    The Tracking API: the parcel's activities, oldest first.

    3 methods

Omnibus\Ups

Api class

final class Api Api.php:11

UPS's REST APIs on an OAuth2 client-credentials token, kept until it expires.

const LIVE = 'https://onlinetools.ups.com'
const TEST = 'https://wwwcie.ups.com'
const VERSION = 'v2409'
public readonly string $accountNumber
public readonly bool $sandbox

Api::__construct()

public function __construct(readonly HttpClientInterface $http, readonly string $clientId, readonly string $clientSecret, public readonly string $accountNumber, public readonly bool $sandbox = false, readonly int $timeout = 20)

Api::base()

public function base(): string

Api::call()

public function call(string $method, string $path, ?array $body = null, array $query = []): array

Mapping class

final class Mapping Mapping.php:10

UPS's shapes for ours.

const SERVICES = ['01' => 'Next Day Air', '02' => '2nd Day Air', '03' => 'Ground', '07' => 'Worldwide Express', '08' => 'Worldwide Expedited', '11' => 'Standard', '12' => '3 …

Mapping::address()

public static function address(Address $a, bool $withAttention = true): array

Mapping::package()

public static function package(Parcel $p): array

Mapping::status()

public static function status(?string $type): TrackingStatus

UpsGatewayFactory class

final class UpsGatewayFactory extends GatewayFactory UpsGatewayFactory.php:21

options: client_id: '%env(UPS_CLIENT_ID)%' # an app in the UPS Developer Portal client_secret: '%env(UPS_CLIENT_SECRET)%' account_number: '%env(UPS_ACCOUNT)%' # the shipper account (6 characters) sandbox: true # the Customer Integration Environment rates: [...] # optional: prices from configuration instead of the Rating API

Options

OptionDefault
sandboxfalse
omnibus.apifunction (Config $c) { $http = $this->http ?? HttpClient::create(); return new Api($http, (string) $c['client_id'], (string) $c['client_secret'], (st…
omnibus.action.ratingstatic fn(Config $c) => $c->get('rates') ? null : new RatingAction()
omnibus.action.shippingnew ShippingAction()
omnibus.action.trackingnew TrackingAction()
omnibus.action.pickupnew PickupAction()
client_idrequired
client_secretrequired
account_numberrequired

Omnibus\Ups\Action

PickupAction class

final class PickupAction implements ActionInterface, ApiAwareInterface PickupAction.php:15

The Locator API: UPS Access Points near an address, nearest first.

PickupAction::__construct()

public function __construct()

PickupAction::supports()

public function supports(Request $request): bool

PickupAction::execute()

public function execute(Request $request): void

RatingAction class

final class RatingAction implements ActionInterface, ApiAwareInterface RatingAction.php:15

The Rating API's Shop: every service UPS can carry the shipment with, priced.

RatingAction::__construct()

public function __construct()

RatingAction::supports()

public function supports(Request $request): bool

RatingAction::execute()

public function execute(Request $request): void

ShippingAction class

final class ShippingAction implements ActionInterface, ApiAwareInterface ShippingAction.php:16

The Shipping API: the shipment booked, its label (PDF by default, "GIF"/"ZPL" through the option label_format).

ShippingAction::__construct()

public function __construct()

ShippingAction::supports()

public function supports(Request $request): bool

ShippingAction::execute()

public function execute(Request $request): void

TrackingAction class

final class TrackingAction implements ActionInterface, ApiAwareInterface TrackingAction.php:17

The Tracking API: the parcel's activities, oldest first.

TrackingAction::__construct()

public function __construct()

TrackingAction::supports()

public function supports(Request $request): bool

TrackingAction::execute()

public function execute(Request $request): void