Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes incorrect login in Example 1 #36

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
5 changes: 2 additions & 3 deletions examples/example-1-submitting-a-printjob.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@
// You first need to establish a connection to PrintNode.
// This can be done by using a PrintNode\ApiKey instance using your api-key.

$credentials = new PrintNode\ApiKey(
PRINTNODE_APIKEY
);
$credentials = new PrintNode\Credentials();
$credentials->setApiKey($config['PRINTNODE_APIKEY']);

// Hint: Your API username is in the format description.integer, where description
// is the name given to the API key when you created it, followed by a dot (.) and an integer.
Expand Down
2 changes: 1 addition & 1 deletion src/PrintNode/Credentials.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function setEmailPassword($email, $password)
"ApiKey already set."
);
}
$this->emailpassword = $email.': '.$password;
$this->emailPassword = $email.': '.$password;
return $this;
}

Expand Down
2 changes: 2 additions & 0 deletions src/PrintNode/PrintJob.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* @property string $contentType
* @property string $content
* @property string $source
* @property array $options
* @property-read int $filesize
* @property-read DateTime $createTimestamp
* @property-read string $state
Expand All @@ -29,6 +30,7 @@ class PrintJob extends Entity
protected $createTimestamp;
protected $state;
protected $expireAt;
protected $options;

public function foreignKeyEntityMap()
{
Expand Down
12 changes: 6 additions & 6 deletions src/PrintNode/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ public function getPrintJobsByPrinters()
* @param string $computerId id of computer to find scales
* @return Entity[]
* */
public function getScales(string $computerId)
public function getScales($computerId)
{
$endPointUrl = $this->apiurl."/computer/";
$endPointUrl.= $computerId;
Expand Down Expand Up @@ -522,7 +522,7 @@ public function getPrintersByComputers()
$arguments = func_get_args();

if (count($arguments) > 2) {
throw new InvalidArgumentException(
throw new \InvalidArgumentException(
sprintf(
'Too many arguments given to getPrintersByComputers.'
)
Expand Down Expand Up @@ -570,7 +570,7 @@ public function __call($methodName, $arguments)
$arguments = array_shift($arguments);

if (!is_string($arguments)) {
throw new InvalidArgumentException(
throw new \InvalidArgumentException(
sprintf(
'Invalid argument type passed to %s. Expecting a string got %s',
$methodName,
Expand Down Expand Up @@ -614,7 +614,7 @@ public function __call($methodName, $arguments)
public function patch(Entity $entity)
{
if (!($entity instanceof Entity)) {
throw new InvalidArgumentException(
throw new \InvalidArgumentException(
sprintf(
'Invalid argument type passed to patch. Expecting Entity got %s',
gettype($entity)
Expand Down Expand Up @@ -644,7 +644,7 @@ public function patch(Entity $entity)
public function post(Entity $entity)
{
if (!($entity instanceof Entity)) {
throw new InvalidArgumentException(
throw new \InvalidArgumentException(
sprintf(
'Invalid argument type passed to patch. Expecting Entity got %s',
gettype($entity)
Expand Down Expand Up @@ -677,7 +677,7 @@ public function put()
$entity = array_shift($arguments);

if (!($entity instanceof Entity)) {
throw new InvalidArgumentException(
throw new \InvalidArgumentException(
sprintf(
'Invalid argument type passed to patch. Expecting Entity got %s',
gettype($entity)
Expand Down
4 changes: 2 additions & 2 deletions src/PrintNode/Scale.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
* @property-read string $port
* @property-read int $count
* @property-read int[string] $measurement
* @property-read DateTime $clientReportedCreateTimestamp
* @property-read \DateTime $clientReportedCreateTimestamp
* @property-read string $ntpOffset
* @property-read int $ageOfData
* @property-read int $computerId
Expand All @@ -29,7 +29,7 @@ class Scale extends Entity
protected $port;
protected $count;
protected $measurement;
protected $clientReprotedCreateTimestamp;
protected $clientReportedCreateTimestamp;
protected $ntpOffset;
protected $ageOfData;
protected $computerId;
Expand Down