@@ -17,7 +17,7 @@ |
||
17 | 17 | 'platform' |
18 | 18 | ); |
19 | 19 | |
20 | - public function data(array $data){ |
|
20 | + public function data(array $data) { |
|
21 | 21 | $data['grant_type'] = 'password'; |
22 | 22 | return parent::data($data); |
23 | 23 | } |
@@ -4,7 +4,7 @@ |
||
4 | 4 | |
5 | 5 | use SugarAPI\SDK\EntryPoint\Abstracts\Abstract_POST_EntryPoint; |
6 | 6 | |
7 | -class CreateRecord extends Abstract_POST_EntryPoint{ |
|
7 | +class CreateRecord extends Abstract_POST_EntryPoint { |
|
8 | 8 | |
9 | 9 | protected $_URL = '$module'; |
10 | 10 |
@@ -5,7 +5,7 @@ |
||
5 | 5 | |
6 | 6 | use SugarAPI\SDK\Exception\Abstracts\AbstractException; |
7 | 7 | |
8 | -class InvalidEntryPoint extends AbstractException{ |
|
8 | +class InvalidEntryPoint extends AbstractException { |
|
9 | 9 | |
10 | 10 | protected $defaultMessage = 'The method you called is not a valid EntryPoint in the SDK.'; |
11 | 11 | protected $failureCodes = array( |
@@ -2,7 +2,7 @@ discard block |
||
2 | 2 | |
3 | 3 | namespace SugarAPI\SDK\Exception\Abstracts; |
4 | 4 | |
5 | -abstract class AbstractException extends \Exception{ |
|
5 | +abstract class AbstractException extends \Exception { |
|
6 | 6 | |
7 | 7 | protected $defaultMessage = 'Unknown SugarAPI SDK Exception Occurred.'; |
8 | 8 | protected $failureCodes = array(); |
@@ -12,15 +12,15 @@ discard block |
||
12 | 12 | parent::__construct($message); |
13 | 13 | } |
14 | 14 | |
15 | - protected function convertCode($code,$string=''){ |
|
16 | - if (array_key_exists($code,$this->failureCodes)){ |
|
15 | + protected function convertCode($code, $string = '') { |
|
16 | + if (array_key_exists($code, $this->failureCodes)) { |
|
17 | 17 | return $this->failureCodes[$code]; |
18 | - }else{ |
|
18 | + }else { |
|
19 | 19 | return $this->defaultMessage; |
20 | 20 | } |
21 | 21 | } |
22 | 22 | |
23 | - public function __toString(){ |
|
23 | + public function __toString() { |
|
24 | 24 | return "SugarAPI SDK Exception [".$this->code." - ".$this->message."] occurred on ".$this->line." in ".$this->file; |
25 | 25 | } |
26 | 26 |
@@ -5,7 +5,7 @@ |
||
5 | 5 | |
6 | 6 | use SugarAPI\SDK\Exception\Abstracts\AbstractException; |
7 | 7 | |
8 | -class AuthenticationError extends AbstractException{ |
|
8 | +class AuthenticationError extends AbstractException { |
|
9 | 9 | |
10 | 10 | protected $defaultMessage = 'Unknown error occurred, when SDK attempted to Authenticate to SugarCRM instance.'; |
11 | 11 | protected $failureCodes = array( |
@@ -1,7 +1,7 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -require_once __DIR__ . '/../vendor/autoload.php'; |
|
3 | +require_once __DIR__.'/../vendor/autoload.php'; |
|
4 | 4 | |
5 | -$SugarAPI = new \SugarAPI\SDK\SugarAPI('instances.this/Ent/7621/',array('username' => 'admin','password'=>'asdf')); |
|
5 | +$SugarAPI = new \SugarAPI\SDK\SugarAPI('instances.this/Ent/7621/', array('username' => 'admin', 'password'=>'asdf')); |
|
6 | 6 | $SugarAPI->login(); |
7 | 7 | print_r($SugarAPI->getToken()); |
8 | 8 | \ No newline at end of file |
@@ -1,19 +1,19 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | |
4 | -require_once __DIR__ . '/../vendor/autoload.php'; |
|
4 | +require_once __DIR__.'/../vendor/autoload.php'; |
|
5 | 5 | |
6 | -try{ |
|
7 | - $SugarAPI = new \SugarAPI\SDK\SugarAPI('instances.this/Pro/7621/',array('username' => 'admin','password'=>'asdf')); |
|
6 | +try { |
|
7 | + $SugarAPI = new \SugarAPI\SDK\SugarAPI('instances.this/Pro/7621/', array('username' => 'admin', 'password'=>'asdf')); |
|
8 | 8 | $SugarAPI->login(); |
9 | 9 | $EP = $SugarAPI->filterRecords('Accounts'); |
10 | 10 | $response = $EP->execute()->getResponse(); |
11 | - if ($response->getStatus()=='200'){ |
|
11 | + if ($response->getStatus()=='200') { |
|
12 | 12 | print_r($response->getBody()); |
13 | - }else{ |
|
13 | + }else { |
|
14 | 14 | print_r($EP); |
15 | 15 | print_r($response->getBody()); |
16 | 16 | } |
17 | -}catch(\SugarAPI\SDK\Exception\AuthenticationError $ex){ |
|
17 | +}catch (\SugarAPI\SDK\Exception\AuthenticationError $ex) { |
|
18 | 18 | print $ex->getMessage(); |
19 | 19 | } |
@@ -1,21 +1,21 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -require_once __DIR__ . '/../vendor/autoload.php'; |
|
3 | +require_once __DIR__.'/../vendor/autoload.php'; |
|
4 | 4 | |
5 | 5 | $record_id = '436dcb0b-14a9-c0d4-3046-5706b186b9b8'; |
6 | 6 | |
7 | -try{ |
|
8 | - $SugarAPI = new \SugarAPI\SDK\SugarAPI('instances.this/Pro/7621/',array('username' => 'admin','password'=>'asdf')); |
|
7 | +try { |
|
8 | + $SugarAPI = new \SugarAPI\SDK\SugarAPI('instances.this/Pro/7621/', array('username' => 'admin', 'password'=>'asdf')); |
|
9 | 9 | $SugarAPI->login(); |
10 | - $EP = $SugarAPI->updateRecord('Accounts',$record_id); |
|
10 | + $EP = $SugarAPI->updateRecord('Accounts', $record_id); |
|
11 | 11 | $EP->getRequest()->setOption(); |
12 | - $record = $SugarAPI->updateRecord('Accounts',$record_id)->data(array( |
|
12 | + $record = $SugarAPI->updateRecord('Accounts', $record_id)->data(array( |
|
13 | 13 | 'name' => 'Test Record 5', |
14 | 14 | 'email1' => '[email protected]' |
15 | 15 | ))->execute()->getResponse()->getBody(); |
16 | 16 | echo "Updated Record: ".$record->id; |
17 | 17 | |
18 | -}catch(\SugarAPI\SDK\Exception\AuthenticationError $ex){ |
|
18 | +}catch (\SugarAPI\SDK\Exception\AuthenticationError $ex) { |
|
19 | 19 | print $ex->getMessage(); |
20 | 20 | } |
21 | 21 |
@@ -1,9 +1,9 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -require_once __DIR__ . '/../vendor/autoload.php'; |
|
3 | +require_once __DIR__.'/../vendor/autoload.php'; |
|
4 | 4 | |
5 | -try{ |
|
6 | - $SugarAPI = new \SugarAPI\SDK\SugarAPI('instances.this/Pro/7621/',array('username' => 'admin','password'=>'asdf')); |
|
5 | +try { |
|
6 | + $SugarAPI = new \SugarAPI\SDK\SugarAPI('instances.this/Pro/7621/', array('username' => 'admin', 'password'=>'asdf')); |
|
7 | 7 | $SugarAPI->login(); |
8 | 8 | $EP = $SugarAPI->createRecord('Accounts'); |
9 | 9 | $EP->data(array( |
@@ -11,14 +11,14 @@ discard block |
||
11 | 11 | 'email1' => '[email protected]' |
12 | 12 | )); |
13 | 13 | $response = $EP->execute()->getResponse(); |
14 | - if ($response->getStatus()=='200'){ |
|
14 | + if ($response->getStatus()=='200') { |
|
15 | 15 | $record = $response->getBody(); |
16 | - $EP2 = $SugarAPI->getRecord('Accounts',$record->id)->data(array('fields' => 'name,email1')); |
|
16 | + $EP2 = $SugarAPI->getRecord('Accounts', $record->id)->data(array('fields' => 'name,email1')); |
|
17 | 17 | $getResponse = $EP2->execute()->getResponse(); |
18 | 18 | print $EP2->getUrl(); |
19 | 19 | print_r($getResponse->getBody()); |
20 | 20 | } |
21 | 21 | |
22 | -}catch(\SugarAPI\SDK\Exception\AuthenticationError $ex){ |
|
22 | +}catch (\SugarAPI\SDK\Exception\AuthenticationError $ex) { |
|
23 | 23 | print $ex->getMessage(); |
24 | 24 | } |
25 | 25 | \ No newline at end of file |