Skip to content

Commit

Permalink
Change functions to run & add aramex facade
Browse files Browse the repository at this point in the history
  • Loading branch information
drashoor committed Nov 8, 2019
1 parent 88e91f7 commit 6f5cfda
Show file tree
Hide file tree
Showing 19 changed files with 116 additions and 59 deletions.
52 changes: 26 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,36 +42,36 @@ Run the following command to install the latest applicable version of the packag
#### Fetch Countries
This method allows users to get the world countries list.

Aramex::FetchCountries()->make();
Aramex::fetchCountries()->run();

#### Fetch Country
This method allows users to get details of a certain country.

Aramex::FetchCountry()
Aramex::fetchCountry()
->setCode('PS')
->make();
->run();

#### Fetch States
This method allows users to get all the states within a certain country (country code).

Aramex::FetchStates()
Aramex::fetchStates()
->setCountryCode('AE')
->make();
->run();

#### Fetch Cities
This method allows users to get all the cities within a certain country (country code). And allows users to get list of the cities that start with a specific prefix. The required nodes to be filled are Client Info and Country Code.

Aramex::FetchCities()
Aramex::fetchCities()
->setCountryCode('AE')
->make();
->run();

#### Validate Address
This method Allows users to search for certain addresses and make sure that the address structure is correct.

Aramex::ValidateAddress()
Aramex::validateAddress()
->setAddress(
(new Address()) ...
)->make()
)->run();

### Rate

Expand All @@ -84,12 +84,12 @@ This method allows users to get rate for source/destinations shipment.

$details = (new ShipmentDetails()) ...;

Aramex::CalculateRate()
Aramex::calculateRate()
->setOriginalAddress($source)
->setDestinationAddress($destination)
->setShipmentDetails($details)
->setPreferredCurrencyCode('USD')
->make();
->run();

### Shipping

Expand Down Expand Up @@ -118,30 +118,30 @@ This method allows users to create a pickup request.
->setReportId(9201)
->setReportType('URL');
Aramex::CreatePickup()
Aramex::createPickup()
->setLabelInfo($labelInfo)
->setPickup($pickup)
->make();
->run();

#### Cancel Pickup
This method allows you to cancel a pickup as long as it is un-assigned or pending details.

Aramex::CancelPickup()
Aramex::cancelPickup()
->setPickupGUID('PICKUP_GUID')
->make();
->run();

#### Create Shipments
This method allows users to create shipments on Aramex’s system.

Aramex::CreateShipments()->make();
Aramex::createShipments()->run();

#### Get Last Shipments Numbers Range
This method allows you to inquire about the last reserved range using a specific entity and product group

Aramex::GetLastShipmentsNumbersRange()
Aramex::getLastShipmentsNumbersRange()
->setEntity('ENTITY')
->setProductGroup('PRODUCT_GROUP')
->make();
->run();

#### Print Label
This method allows the user to print a label for an existing shipment.
Expand All @@ -150,37 +150,37 @@ This method allows the user to print a label for an existing shipment.
->setReportId(9201)
->setReportType('URL');
Aramex::PrintLabel()
Aramex::printLabel()
->setShipmentNumber('SHIPMENT_NO')
->setLabelInfo()
->make();
->run();

#### Reserve Shipment Number Range
This method allows you to reserve a range of shipment numbers.

Aramex::ReserveShipmentNumberRange()->make();
Aramex::reserveShipmentNumberRange()->run();

#### Schedule Delivery
This method allows you to schedule the delivery of a shipment at a specified time and place (Longitude and Latitude)

Aramex::ScheduleDelivery()->make();
Aramex::scheduleDelivery()->run();

### Tracking

#### Track Pickup
This method allows the user to track an existing pickup’s updates and latest status.

Aramex::TrackPickup()
Aramex::trackPickup()
->setReference('PICKUP_NO')
->setPickup('PICKUP') // any number
->track();
->run();

#### Track Shipments
This method allows the user to track an existing shipment’s updates and latest status.

Aramex::TrackShipments()
Aramex::trackShipments()
->setShipments(['SHIPMENT_NO'])
->make();
->run();
## Credits

Expand Down
2 changes: 1 addition & 1 deletion src/API/Requests/Location/FetchCities.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class FetchCities extends API implements Normalize
* @return CitiesFetchingResponse
* @throws \Exception
*/
public function make()
public function run()
{
$this->validate();

Expand Down
2 changes: 1 addition & 1 deletion src/API/Requests/Location/FetchCountries.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class FetchCountries extends API implements Normalize
* @return CountriesFetchingResponse
* @throws \Exception
*/
public function make()
public function run()
{
$this->validate();

Expand Down
2 changes: 1 addition & 1 deletion src/API/Requests/Location/FetchCountry.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class FetchCountry extends API implements Normalize
* @return CountryFetchingResponse
* @throws Exception
*/
public function make()
public function run()
{
$this->validate();

Expand Down
2 changes: 1 addition & 1 deletion src/API/Requests/Location/FetchOffices.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class FetchOffices extends API implements Normalize
* @return OfficesFetchingResponse
* @throws Exception
*/
public function make()
public function run()
{
$this->validate();

Expand Down
2 changes: 1 addition & 1 deletion src/API/Requests/Location/FetchStates.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class FetchStates extends API implements Normalize
* @return StatesFetchingResponse
* @throws Exception
*/
public function make()
public function run()
{
$this->validate();

Expand Down
2 changes: 1 addition & 1 deletion src/API/Requests/Location/ValidateAddress.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class ValidateAddress extends API implements Normalize
* @return AddressValidationResponse
* @throws \Exception
*/
public function make()
public function run()
{
$this->validate();

Expand Down
2 changes: 1 addition & 1 deletion src/API/Requests/Rate/CalculateRate.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function __construct()
* @return RateCalculatorResponse
* @throws Exception
*/
public function make()
public function run()
{
$this->validate();

Expand Down
2 changes: 1 addition & 1 deletion src/API/Requests/Shipping/CancelPickup.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class CancelPickup extends API implements Normalize
* @return PickupCancellationResponse
* @throws Exception
*/
public function make(): PickupCancellationResponse
public function run(): PickupCancellationResponse
{
$this->validate();

Expand Down
2 changes: 1 addition & 1 deletion src/API/Requests/Shipping/CreatePickup.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class CreatePickup extends API implements Normalize
* @return PickupCreationResponse
* @throws Exception
*/
public function make(): PickupCreationResponse
public function run(): PickupCreationResponse
{
$this->validate();

Expand Down
2 changes: 1 addition & 1 deletion src/API/Requests/Shipping/CreateShipments.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class CreateShipments extends API implements Normalize
* @return ShipmentCreationResponse
* @throws Exception
*/
public function make(): ShipmentCreationResponse
public function run(): ShipmentCreationResponse
{
$this->validate();

Expand Down
2 changes: 1 addition & 1 deletion src/API/Requests/Shipping/GetLastShipmentsNumbersRange.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class GetLastShipmentsNumbersRange extends API implements Normalize
* @return LastReservedShipmentNumberRangeResponse
* @throws Exception
*/
public function make(): LastReservedShipmentNumberRangeResponse
public function run(): LastReservedShipmentNumberRangeResponse
{
$this->validate();

Expand Down
2 changes: 1 addition & 1 deletion src/API/Requests/Shipping/PrintLabel.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class PrintLabel extends API implements Normalize
* @return LabelPrintingResponse
* @throws Exception
*/
public function make(): LabelPrintingResponse
public function run(): LabelPrintingResponse
{
$this->validate();

Expand Down
2 changes: 1 addition & 1 deletion src/API/Requests/Shipping/ReserveShipmentNumberRange.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class ReserveShipmentNumberRange extends API implements Normalize
* @return ReserveRangeResponse
* @throws Exception
*/
public function make(): ReserveRangeResponse
public function run(): ReserveRangeResponse
{
$this->validate();

Expand Down
2 changes: 1 addition & 1 deletion src/API/Requests/Shipping/ScheduleDelivery.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class ScheduleDelivery extends API implements Normalize
* @return ScheduledDeliveryResponse
* @throws Exception
*/
public function make(): ScheduledDeliveryResponse
public function run(): ScheduledDeliveryResponse
{
$this->validate();

Expand Down
2 changes: 1 addition & 1 deletion src/API/Requests/Tracking/TrackPickup.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class TrackPickup extends API implements Normalize
* @return PickupTrackingResponse
* @throws Exception
*/
public function make()
public function run()
{
$this->validate();

Expand Down
2 changes: 1 addition & 1 deletion src/API/Requests/Tracking/TrackShipments.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class TrackShipments extends API implements Normalize
* @return ShipmentTrackingResponse
* @throws Exception
*/
public function make()
public function run()
{
$this->validate();

Expand Down
34 changes: 17 additions & 17 deletions src/Aramex.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,90 +23,90 @@
class Aramex
{
// Location
public static function FetchCities()
public static function fetchCities()
{
return new FetchCities();
}

public static function FetchCountries()
public static function fetchCountries()
{
return new FetchCountries();
}

public static function FetchCountry()
public static function fetchCountry()
{
return new FetchCountry();
}

public static function FetchDropOffLocations()
public static function fetchDropOffLocations()
{
return new FetchDropOffLocations();
}

public static function FetchOffices()
public static function fetchOffices()
{
return new FetchOffices();
}

public static function FetchStates()
public static function fetchStates()
{
return new FetchStates();
}

public static function ValidateAddress()
public static function validateAddress()
{
return new ValidateAddress();
}

// Rate
public static function CalculateRate()
public static function calculateRate()
{
return new CalculateRate();
}

// Shipping
public static function CancelPickup()
public static function cancelPickup()
{
return new CancelPickup();
}

public static function CreatePickup()
public static function createPickup()
{
return new CreatePickup();
}

public static function CreateShipments()
public static function createShipments()
{
return new CreateShipments();
}

public static function GetLastShipmentsNumbersRange()
public static function getLastShipmentsNumbersRange()
{
return new GetLastShipmentsNumbersRange();
}

public static function PrintLabel()
public static function printLabel()
{
return new PrintLabel();
}

public static function ReserveShipmentNumberRange()
public static function reserveShipmentNumberRange()
{
return new ReserveShipmentNumberRange();
}

public static function ScheduleDelivery()
public static function scheduleDelivery()
{
return new ScheduleDelivery();
}

// Tracking
public static function TrackPickup()
public static function trackPickup()
{
return new TrackPickup();
}

public static function TrackShipments()
public static function trackShipments()
{
return new TrackShipments();
}
Expand Down
Loading

0 comments on commit 6f5cfda

Please sign in to comment.