Skip to content

Commit

Permalink
- Renamed folders
Browse files Browse the repository at this point in the history
  • Loading branch information
vityachis committed Jul 16, 2019
1 parent 32ea1ae commit a3868b9
Show file tree
Hide file tree
Showing 17 changed files with 79 additions and 1,846 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Stamps API Client for creating shipping labels, envelopes, checking addresses, e
$to = []; // Sender's address
$from = []; // Address of the recipient

$toAddress = (new \integready\Stamps\Address\Address())
$toAddress = (new \integready\stamps\address\Address())
->setFullname($to['fullname'])
->setAddress1($to['address1'])
->setAddress2($to['address2'])
Expand All @@ -17,7 +17,7 @@ $toAddress = (new \integready\Stamps\Address\Address())
->setZipcode($to['zipCode'])
->setCountry($to['country']);

$fromAddress = (new \integready\Stamps\Address\Address())
$fromAddress = (new \integready\stamps\address\Address())
->setFullname($from['fullname'])
->setAddress1($from['address1'])
->setAddress2($from['address2'])
Expand All @@ -27,16 +27,16 @@ $fromAddress = (new \integready\Stamps\Address\Address())
->setCountry($from['country']);

try {
$shippingLabel = (new \integready\Stamps\Api\Envelope())
$shippingLabel = (new \integready\stamps\api\Envelope())
->setApiUrl(API_URL) // Leave out for default
->setApiIntegrationId(YOUR_API_INTEGRATION_ID)
->setApiUserId(YOUR_API_USER_ID)
->setApiPassword(YOUR_API_PASSWORD)
->setImageType(\IntegReady\Stamps\Api\Envelope::IMAGE_TYPE_PNG)
->setPackageType(\IntegReady\Stamps\Api\Envelope::RATE_PACKAGE_TYPE_LETTER)
->setServiceType(\IntegReady\Stamps\Api\Envelope::RATE_SERVICE_TYPE_US_FC)
->setPrintLayout(\IntegReady\Stamps\Api\Envelope::RATE_PRINT_LAYOUT_ENVELOPE10)
->setMode(\IntegReady\Stamps\Api\Envelope::MODE_NOPOSTAGE)
->setImageType(\integready\stamps\api\Envelope::IMAGE_TYPE_PNG)
->setPackageType(\integready\stamps\api\Envelope::RATE_PACKAGE_TYPE_LETTER)
->setServiceType(\integready\stamps\api\Envelope::RATE_SERVICE_TYPE_US_FC)
->setPrintLayout(\integready\stamps\api\Envelope::RATE_PRINT_LAYOUT_ENVELOPE10)
->setMode(\integready\stamps\api\Envelope::MODE_NOPOSTAGE)
->setFrom($fromAddress)
->setTo($toAddress)
->setIsSampleOnly(false)
Expand Down
21 changes: 14 additions & 7 deletions src/Address/Address.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ class Address implements AddressInterface
*/
public function setFullname($fullname)
{
$this->fullname = (string) $fullname;
$this->fullname = (string)$fullname;

return $this;
}

Expand All @@ -64,7 +65,8 @@ public function getFullname()
*/
public function setAddress1($address1)
{
$this->address1 = (string) $address1;
$this->address1 = (string)$address1;

return $this;
}

Expand All @@ -81,7 +83,8 @@ public function getAddress1()
*/
public function setAddress2($address2)
{
$this->address2 = (string) $address2;
$this->address2 = (string)$address2;

return $this;
}

Expand All @@ -98,7 +101,8 @@ public function getAddress2()
*/
public function setCity($city)
{
$this->city = (string) $city;
$this->city = (string)$city;

return $this;
}

Expand All @@ -115,7 +119,8 @@ public function getCity()
*/
public function setState($state)
{
$this->state = (string) $state;
$this->state = (string)$state;

return $this;
}

Expand All @@ -132,7 +137,8 @@ public function getState()
*/
public function setZipcode($zipcode)
{
$this->zipcode = (string) $zipcode;
$this->zipcode = (string)$zipcode;

return $this;
}

Expand All @@ -149,7 +155,8 @@ public function getZipcode()
*/
public function setCountry($country = 'US')
{
$this->country = (string) $country;
$this->country = (string)$country;

return $this;
}

Expand Down
9 changes: 8 additions & 1 deletion src/Address/AddressInterface.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace integready\Stamps\Address;
namespace integready\stamps\address;

/**
* Interface for creating a mailing address.
Expand All @@ -9,6 +9,7 @@ interface AddressInterface
{
/**
* @param string $fullname
*
* @return $this
*/
public function setFullname($fullname);
Expand All @@ -20,6 +21,7 @@ public function getFullname();

/**
* @param string $address1
*
* @return $this
*/
public function setAddress1($address1);
Expand All @@ -31,6 +33,7 @@ public function getAddress1();

/**
* @param string $address2
*
* @return $this
*/
public function setAddress2($address2);
Expand All @@ -42,6 +45,7 @@ public function getAddress2();

/**
* @param string $city
*
* @return $this
*/
public function setCity($city);
Expand All @@ -53,6 +57,7 @@ public function getCity();

/**
* @param string $state
*
* @return $this
*/
public function setState($state);
Expand All @@ -64,6 +69,7 @@ public function getState();

/**
* @param string $zipcode
*
* @return $this
*/
public function setZipcode($zipcode);
Expand All @@ -75,6 +81,7 @@ public function getZipcode();

/**
* @param string $country
*
* @return $this
*/
public function setCountry($country = 'US');
Expand Down
20 changes: 12 additions & 8 deletions src/Api/AbstractClient.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php

namespace integready\Stamps\Api;
namespace integready\stamps\api;

use \SoapClient;
use SoapClient;

/**
* Base API client.
Expand Down Expand Up @@ -40,7 +40,7 @@ abstract class AbstractClient implements ClientInterface
public function __construct()
{
$this->soapClient = new SoapClient($this->apiUrl, [
'exceptions' => true
'exceptions' => true,
]);
}

Expand All @@ -51,6 +51,7 @@ public function setApiUrl($url)
{
$this->apiUrl = $url;
$this->soapClient->__setLocation($this->apiUrl);

return $this;
}

Expand All @@ -67,7 +68,8 @@ public function getApiUrl()
*/
public function setApiIntegrationId($integrationId)
{
$this->apiIntegrationId = (string) $integrationId;
$this->apiIntegrationId = (string)$integrationId;

return $this;
}

Expand All @@ -84,7 +86,8 @@ public function getApiIntegrationId()
*/
public function setApiUserId($userId)
{
$this->apiUserId = (string) $userId;
$this->apiUserId = (string)$userId;

return $this;
}

Expand All @@ -101,7 +104,8 @@ public function getApiUserId()
*/
public function setApiPassword($password)
{
$this->apiPassword = (string) $password;
$this->apiPassword = (string)$password;

return $this;
}

Expand All @@ -121,7 +125,7 @@ public function getApiPassword()
protected function getAuthToken()
{
$response = $this->soapClient->AuthenticateUser([
'Credentials' => $this->getCredentials()
'Credentials' => $this->getCredentials(),
]);

return $response->Authenticator;
Expand All @@ -135,7 +139,7 @@ protected function getCredentials()
return [
'IntegrationID' => $this->apiIntegrationId,
'Username' => $this->apiUserId,
'Password' => $this->apiPassword
'Password' => $this->apiPassword,
];
}
}
6 changes: 5 additions & 1 deletion src/Api/ClientInterface.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace integready\Stamps\Api;
namespace integready\stamps\api;

/**
* Base interface for API clients.
Expand All @@ -9,6 +9,7 @@ interface ClientInterface
{
/**
* @param string $url
*
* @return $this
*/
public function setApiUrl($url);
Expand All @@ -20,6 +21,7 @@ public function getApiUrl();

/**
* @param string $integrationId
*
* @return $this
*/
public function setApiIntegrationId($integrationId);
Expand All @@ -31,6 +33,7 @@ public function getApiIntegrationId();

/**
* @param string $userId
*
* @return $this
*/
public function setApiUserId($userId);
Expand All @@ -42,6 +45,7 @@ public function getApiUserId();

/**
* @param string $password
*
* @return $this
*/
public function setApiPassword($password);
Expand Down
4 changes: 2 additions & 2 deletions src/Api/Envelope.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?php

namespace integready\Stamps\Api;
namespace integready\stamps\api;

use Exception as ApiException;
use integready\Stamps\Address\AddressInterface;
use integready\stamps\address\AddressInterface;

/**
* Client to generate shipping labels.
Expand Down
6 changes: 4 additions & 2 deletions src/Api/Exception.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
<?php

namespace integready\Stamps\Api;
namespace integready\stamps\api;

/**
* Exception thrown for whatever reason.
*/
class Exception extends \Exception {}
class Exception extends \Exception
{
}
Loading

0 comments on commit a3868b9

Please sign in to comment.