@@ -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 | 7 | try{ |
| 8 | - $SugarAPI = new \SugarAPI\SDK\SugarAPI('instances.this/Pro/7621/',array('username' => 'admin','password'=>'asdf')); |
|
| 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\AuthenticationException $ex){ |
|
| 18 | +}catch (\SugarAPI\SDK\Exception\AuthenticationException $ex){ |
|
| 19 | 19 | print $ex->getMessage(); |
| 20 | 20 | } |
| 21 | 21 | |
@@ -1,13 +1,13 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -require_once __DIR__ . '/../vendor/autoload.php'; |
|
| 3 | +require_once __DIR__.'/../vendor/autoload.php'; |
|
| 4 | 4 | |
| 5 | 5 | $recordID = 'ac096703-67fd-8dd2-980a-57097932f07a'; |
| 6 | 6 | |
| 7 | 7 | try{ |
| 8 | - $SugarAPI = new \SugarAPI\SDK\SugarAPI('instances.this/Ent/7700/',array('username' => 'admin','password'=>'asdf')); |
|
| 8 | + $SugarAPI = new \SugarAPI\SDK\SugarAPI('instances.this/Ent/7700/', array('username' => 'admin', 'password'=>'asdf')); |
|
| 9 | 9 | $SugarAPI->login(); |
| 10 | - $EP = $SugarAPI->getAttachment('Notes',$recordID,'filename')->downloadTo(__DIR__)->execute(); |
|
| 10 | + $EP = $SugarAPI->getAttachment('Notes', $recordID, 'filename')->downloadTo(__DIR__)->execute(); |
|
| 11 | 11 | $response = $EP->getResponse(); |
| 12 | 12 | if ($response->getStatus()=='200'){ |
| 13 | 13 | if (file_exists($response->file())){ |
@@ -20,6 +20,6 @@ discard block |
||
| 20 | 20 | print_r($response->getBody()); |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | -}catch(\SugarAPI\SDK\Exception\SDKException $ex){ |
|
| 23 | +}catch (\SugarAPI\SDK\Exception\SDKException $ex){ |
|
| 24 | 24 | print $ex->getMessage(); |
| 25 | 25 | } |
| 26 | 26 | \ No newline at end of file |
@@ -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 | 5 | try{ |
| 6 | - $SugarAPI = new \SugarAPI\SDK\SugarAPI('instances.this/Pro/7621/',array('username' => 'admin','password'=>'asdf')); |
|
| 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( |
@@ -13,12 +13,12 @@ discard block |
||
| 13 | 13 | $response = $EP->execute()->getResponse(); |
| 14 | 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\AuthenticationException $ex){ |
|
| 22 | +}catch (\SugarAPI\SDK\Exception\AuthenticationException $ex){ |
|
| 23 | 23 | print $ex->getMessage(); |
| 24 | 24 | } |
| 25 | 25 | \ No newline at end of file |
@@ -1,22 +1,22 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | |
| 4 | -require_once __DIR__ . '/../vendor/autoload.php'; |
|
| 4 | +require_once __DIR__.'/../vendor/autoload.php'; |
|
| 5 | 5 | |
| 6 | 6 | try{ |
| 7 | - $SugarAPI = new \SugarAPI\SDK\SugarAPI('instances.this/Pro/7700/',array('username' => 'admin','password'=>'asdf')); |
|
| 7 | + $SugarAPI = new \SugarAPI\SDK\SugarAPI('instances.this/Pro/7700/', array('username' => 'admin', 'password'=>'asdf')); |
|
| 8 | 8 | $SugarAPI->login(); |
| 9 | 9 | $EP = $SugarAPI->filterRecords('Accounts'); |
| 10 | 10 | $response = $EP->execute()->getResponse(); |
| 11 | 11 | if ($response->getStatus()=='200'){ |
| 12 | 12 | $recordList = $response->getBody(); |
| 13 | - $max=count($recordList->records); |
|
| 13 | + $max = count($recordList->records); |
|
| 14 | 14 | echo "found $max records from Filter Records request. <br>"; |
| 15 | - $number = rand(0,$max); |
|
| 15 | + $number = rand(0, $max); |
|
| 16 | 16 | $randomRecord = $recordList->records[$number]; |
| 17 | 17 | echo "Choose random record #$number, with ID: ".$randomRecord->id." <br>"; |
| 18 | 18 | |
| 19 | - $getRecord = $SugarAPI->getRecord('Accounts',$randomRecord->id)->data(array( |
|
| 19 | + $getRecord = $SugarAPI->getRecord('Accounts', $randomRecord->id)->data(array( |
|
| 20 | 20 | 'fields' => 'name' |
| 21 | 21 | ))->execute(); |
| 22 | 22 | $response = $getRecord->getResponse(); |
@@ -78,9 +78,9 @@ discard block |
||
| 78 | 78 | * Configure the static property $_DEFAULTS with settings from defaults.php |
| 79 | 79 | */ |
| 80 | 80 | protected function loadDefaults(){ |
| 81 | - if (empty(static::$_DEFAULTS)) { |
|
| 82 | - include __DIR__ . DIRECTORY_SEPARATOR . 'defaults.php'; |
|
| 83 | - if (isset($defaults)) { |
|
| 81 | + if (empty(static::$_DEFAULTS)){ |
|
| 82 | + include __DIR__.DIRECTORY_SEPARATOR.'defaults.php'; |
|
| 83 | + if (isset($defaults)){ |
|
| 84 | 84 | static::$_DEFAULTS = $defaults; |
| 85 | 85 | } |
| 86 | 86 | } |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | $response = $EP->data($this->authOptions)->execute()->getResponse(); |
| 169 | 169 | if ($response->getStatus()=='200'){ |
| 170 | 170 | $this->authToken = $response->getBody(); |
| 171 | - } else{ |
|
| 171 | + }else{ |
|
| 172 | 172 | throw new AuthenticationException($response->getBody()); |
| 173 | 173 | } |
| 174 | 174 | } |