Diglin\Ricardo\Api
Class Api
Prepare HTTP headers, send params, connect and get response from the API
Synopsis
- // members
- protected ConfigInterface $_config;
- protected $_username;
- protected $_partnerKey;
- protected bool $_debug = false;
- protected array $_lastDebug = ;
- protected bool $_shouldSetPass = true;
- // methods
- public void __construct()
- public mixed connect()
- protected array _addHeaders()
- public Config getConfig()
- public $this setUsername()
- public mixed getUsername()
- public $this setShouldSetPass()
- public boolean getShouldSetPass()
- public array getLastDebug()
- public string revertUsername()
- public bool removePictureBytesData()
- public string jsonEncode()
Hierarchy
Implements
Violations
PHPMessDetector
Line | Rule | Message |
---|---|---|
85 - 148 | CyclomaticComplexity | The method connect() has a Cyclomatic Complexity of 10. The configured cyclomatic complexity threshold is 10. |
286 - 314 | CyclomaticComplexity | The method jsonEncode() has a Cyclomatic Complexity of 14. The configured cyclomatic complexity threshold is 10. |
286 - 314 | NPathComplexity | The method jsonEncode() has an NPath complexity of 5760. The configured NPath complexity threshold is 200. |
Members
protected
- $_config — Diglin\Ricardo\Core\ConfigInterface
- $_debug — Diglin\Ricardo\bool
- $_lastDebug — array
- $_partnerKey — string
- $_shouldSetPass — Diglin\Ricardo\bool
- $_username — string
Methods
protected
- _addHeaders() — Set correct HTTP headers for the API
public
- __construct()
- connect() — Connect to the Ricardo API depending of the service and method to be used
- getConfig() — Get the configuration class of the API
- getLastDebug() — Get the content of the headers and content of one or more API calls
- getShouldSetPass() — Get if the pass should be send or not
- getUsername() — Get the username
- jsonEncode() — We implement our own json encode function to allow to have value having [...] as string and to prevent to be kept as a string when formatted as json
- removePictureBytesData()
- revertUsername() — The username can be a token or the partner ID.
- setShouldSetPass() — Set if the pass should be send or not
- setUsername() — Username is in fact the API key but we call it username to be homogeneous with the header naming convention
History
-
2015-04-25T15:28:16+02:00 (commit #7ae4261)
Author: Sylvain Rayé (sly@diglin.com) / Commiter: Sylvain Rayé (sly@diglin.com)
Add technical exception class, check if a directory exist before to try to create a new one when debugging is used
-
2015-03-17T13:43:13+01:00 (commit #143b280)
Author: Sylvain Rayé (sly@diglin.com) / Commiter: Sylvain Rayé (sly@diglin.com)
Tiny improvements for saves of log content
-
2015-03-09T20:04:16+01:00 (commit #320c25e)
Author: Sylvain Rayé (sly@diglin.com) / Commiter: Sylvain Rayé (sly@diglin.com)
Remove Curl Cipher due to ricardo SSL Certificate changes
-
2015-02-21T13:52:07+01:00 (commit #c79290f)
Author: Sylvain Rayé (sly@diglin.com) / Commiter: Sylvain Rayé (sly@diglin.com)
Change curl option from 0 to 6 after changes done on ricardo.ch side regarding their SSL Certificate policy,, return debug information in the same format as the one sent to ricardo, do not format string starting with [ (string may be formatted this way to send picture bytes array
-
2015-02-18T02:47:11+01:00 (commit #2276629)
Author: Sylvain Rayé (sly@diglin.com) / Commiter: Sylvain Rayé (sly@diglin.com)
Fix character escape for json string
-
2015-02-08T17:13:03+01:00 (commit #d631ec7)
Author: Sylvain Rayé (sly@diglin.com) / Commiter: Sylvain Rayé (sly@diglin.com)
Implement own json encode method to allow to send pre-encoded json array (needed in case of picture set as parameter as it is byte array and PHP consumes lots of memory with an array)
-
2015-02-05T13:02:27+01:00 (commit #17cc8fe)
Author: Sylvain Rayé (sly@diglin.com) / Commiter: Sylvain Rayé (sly@diglin.com)
Change license from OSL v3 to GPL v3
-
2015-02-05T10:15:07+01:00 (commit #98b7374)
Author: Sylvain Rayé (sly@diglin.com) / Commiter: Sylvain Rayé (sly@diglin.com)
Try to force TLS connection when curl is used
-
2015-02-03T11:09:11+01:00 (commit #070665e)
Author: Sylvain Rayé (sly@diglin.com) / Commiter: Sylvain Rayé (sly@diglin.com)
Change the type of parameters can be given with curl into the API to allow more flexibility and provide encoded json directly without to be done at API class level (for example to allow picture to be already embed as json instead as array cause of memory consumption
-
2014-12-16T12:45:07+01:00 (commit #ec26574)
Author: Sylvain Rayé (sylvain.raye@rissip.com) / Commiter: Sylvain Rayé (sylvain.raye@rissip.com)
PSR2 compliant
-
2014-11-29T21:35:16+01:00 (commit #b245fb0)
Author: Sylvain Rayé (sly@diglin.com) / Commiter: Sylvain Rayé (sly@diglin.com)
Remove PictureBytes when debug data is returned. Prevent problems
-
2014-10-21T02:08:42+02:00 (commit #1b5577c)
Author: Sylvain Rayé (sly@diglin.com) / Commiter: Sylvain Rayé (sly@diglin.com)
Anonymize username and password for log and debug for future use
-
2014-10-20T13:39:26+02:00 (commit #177d730)
Author: Sylvain Rayé (sly@diglin.com) / Commiter: Sylvain Rayé (sly@diglin.com)
update
-
2014-10-06T14:17:38+02:00 (commit #bf96f34)
Author: Sylvain Rayé (sly@diglin.com) / Commiter: Sylvain Rayé (sly@diglin.com)
Change Partner ID to Partner Key to keep ricardo terminology
-
2014-09-28T11:22:59+02:00 (commit #3e11a2c)
Author: Sylvain Rayé (sly@diglin.com) / Commiter: Sylvain Rayé (sly@diglin.com)
Update the License to OSL v3.0, add license file, change code header and composer.json
-
2014-08-31T21:01:48+02:00 (commit #72cadb7)
Author: Sylvain Rayé (sly@diglin.com) / Commiter: Sylvain Rayé (sly@diglin.com)
[RIC-38] Add curl exception in case of connection problem
-
2014-08-10T20:18:28+02:00 (commit #fc0e52a)
Author: Sylvain Rayé (sly@diglin.com) / Commiter: Sylvain Rayé (sly@diglin.com)
Standardize namespace use
-
2014-08-09T12:47:21+02:00 (commit #f472deb)
Author: Sylvain Rayé (sly@diglin.com) / Commiter: Sylvain Rayé (sly@diglin.com)
[RIC-38] Implements getSellerPackages Service
-
2014-07-01T13:49:07+02:00 (commit #37b2bde)
Author: Sylvain Rayé (sly@diglin.com) / Commiter: Sylvain Rayé (sly@diglin.com)
Add test for Helper, add to the helper a method to convert in both directions date from/to json/php, add the Ricardo Service System and its test (still in progress), improve information of error curl message, add method into the testAbstract to get the latest api debug
-
2014-06-22T17:08:27+02:00 (commit #61fc8b6)
Author: Sylvain Rayé (sly@diglin.com) / Commiter: Sylvain Rayé (sly@diglin.com)
Add PhpUnit Tests for Security, SellerAccount (in progress) and System (in progress) Services. Add a way to configure the unit test, documentation exist to configure it thanks to a readme file Implement the security protocol at the manager level
-
2014-06-15T22:30:44+02:00 (commit #6b76b24)
Author: Sylvain Rayé (sly@diglin.com) / Commiter: Sylvain Rayé (sly@diglin.com)
change folders structure, add script specific for Magento to allow to install the library into it
-
2014-06-15T13:58:22+02:00 (commit #e3161ff)
Author: Sylvain Rayé (sly@diglin.com) / Commiter: Sylvain Rayé (sly@diglin.com)
init commit