Skip to content

Commit

Permalink
0.0.3
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitrii-fediuk committed Jul 6, 2017
1 parent 2b8e802 commit 6227806
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 2 deletions.
8 changes: 8 additions & 0 deletions API/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,12 @@ final protected function headers() {return ['Authorization' => "Zoho-authtoken {
final protected function uriBase() {return sprintf(
"https://%s.zoho.com/api/v{$this->version()}", df_zoho_app_lc($this)
);}

/**
* 2017-07-06
* @see \Df\API\Client::responseValidatorC()
* @used-by \Df\API\Client::p()
* @return string
*/
final protected function responseValidatorC() {return \Df\ZohoBI\API\Validator::class;}
}
56 changes: 56 additions & 0 deletions API/Validator.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php
namespace Df\ZohoBI\API;
/**
* 2017-07-06
* An error response looks like:
* {
* "code": 5,
* "message": "Invalid URL Passed"
* }
* A successful response looks like:
* {
* "code": 0,
* "message": "success",
* "<data key>": <data>
* }
* https://www.zoho.eu/books/api/v3/#response
* https://www.zoho.eu/inventory/api/v1/#response
* @used-by \Df\ZohoBI\API\Client::responseValidatorC()
*/
final class Validator extends \Df\API\Response\Validator {
/**
* 2017-07-06
* @override
* @see \Df\API\Response\Validator::message()
* @used-by \Df\API\Response\Validator::validate()
* @return string
*/
protected function message() {return $this->r()['message'];}

/**
* 2017-07-06
* @override
* @see \Df\API\Response\Validator::rs()
* @used-by \Df\API\Response\Validator::validate()
* @return string
*/
protected function rs() {return df_json_encode_pretty($this->r());}

/**
* 2017-07-06
* @override
* @see \Df\API\Response\Validator::title()
* @used-by \Df\API\Response\Validator::validate()
* @return string
*/
protected function title() {return 'Zoho ' . df_zoho_app($this->c()->m());}

/**
* 2017-07-06
* @override
* @see \Df\API\Response\Validator::valid()
* @used-by \Df\API\Response\Validator::validate()
* @return bool
*/
protected function valid() {return 0 === $this->r()['code'];}
}
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mage2pro/zoho-bi"
,"version": "0.0.2"
,"version": "0.0.3"
,"description": "A common library for my «Zoho Books» and «Zoho Inventory» Magento 2 extensions."
,"type": "magento2-module"
,"homepage": "https://mage2.pro/tags/zoho"
Expand All @@ -11,7 +11,7 @@
"homepage": "https://mage2.pro/users/dmitry_fedyuk",
"role": "Developer"
}]
,"require": {"mage2pro/core": ">=2.7.38", "mage2pro/zoho": ">=0.0.4"}
,"require": {"mage2pro/core": ">=2.7.39", "mage2pro/zoho": ">=0.0.4"}
,"autoload": {"files": ["registration.php"], "psr-4": {"Df\\ZohoBI\\": ""}}
,"keywords": [
"Zoho"
Expand Down

0 comments on commit 6227806

Please sign in to comment.