Weble / ZohoBooksApi

40 stars 42 forks source link

New ZohoBooks Class Requires 3 Arguments #44

Closed orielsystems closed 4 years ago

orielsystems commented 4 years ago

Hi,

I am unable to fetch anything due to oAuth issues. I have created my own oAuth handler and produce an Auth Token every hour via Cron on my system.

The problem I am having is that I am unable to setup the library as per your readme section by entering the existing authorisation token as the sole parameter, as an error is thrown and on looking at the ZohoBooks class file it looks as though there are 3 parameters expected, client id, secret and refresh token. When I use these parameters the object is created, however trying to call any api's I get another error with oAuth.

Please can you advise how to pass the already generated Authorisation token to the class.

I have pasted the response I received below. Fatal error: Uncaught ArgumentCountError: Too few arguments to function Webleit\ZohoBooksApi\ZohoBooks::__construct(), 1 passed in /home/pstructures/admin.pstructures.com/custom/zbsync/class/zbsync.class.php on line 348 and at least 2 expected in /home/pstructures/admin.pstructures.com/custom/zbsync/vendor/webleit/zohobooksapi/src/ZohoBooks.php:107 Stack trace: #0 /home/pstructures/admin.pstructures.com/custom/zbsync/class/zbsync.class.php(348): Webleit\ZohoBooksApi\ZohoBooks->__construct(''1000.ab1963db1...') #1 /home/pstructures/admin.pstructures.com/custom/zbsync/class/zbsync.class.php(199): zbSync->syncItems() #2 /home/pstructures/admin.pstructures.com/custom/zbsync/admin/setup.php(127): zbSync->syncZohoBooks('manual') #3 {main} thrown in /home/pstructures/admin.pstructures.com/custom/zbsync/vendor/webleit/zohobooksapi/src/ZohoBooks.php on line 107

and the other error is

Fatal error: Uncaught Weble\ZohoClient\Exception\ApiError: general_error in /home/pstructures/admin.pstructures.com/custom/zbsync/vendor/weble/zohoclient/src/OAuthClient.php:229 Stack trace: #0 /home/pstructures/admin.pstructures.com/custom/zbsync/vendor/weble/zohoclient/src/OAuthClient.php(179): Weble\ZohoClient\OAuthClient->generateAccessToken() #1 /home/pstructures/admin.pstructures.com/custom/zbsync/vendor/webleit/zohobooksapi/src/Client.php(301): Weble\ZohoClient\OAuthClient->getAccessToken() #2 /home/pstructures/admin.pstructures.com/custom/zbsync/vendor/webleit/zohobooksapi/src/Client.php(165): Webleit\ZohoBooksApi\Client->getOptions(Array) #3 /home/pstructures/admin.pstructures.com/custom/zbsync/vendor/webleit/zohobooksapi/src/Modules/Module.php(41): Webleit\ZohoBooksApi\Client->getList('https://books.z...', NULL, Array) #4 /home/pstructures/admin.pstructures.com/custom/zbsync/class/zbsync.class.php(350): Webleit\ZohoBooksApi\Modules\Module->getList() #5 /home/pstructures/admin.pstructures.com/custom/zbsync/class/ in /home/pstructures/admin.pstructures.com/custom/zbsync/vendor/weble/zohoclient/src/OAuthClient.php on line 229

Skullbock commented 4 years ago

hi, thanks for the notice. I've updated the docs (i don't know why my commit didn't go through before for the v3 changes...)

the connection method in the v3 version of the library uses the new oAuth2 method instead of the auth token.

If you want more examples on how to connect, check also the tests folder, ApiTest.php class, where more methods are expose.

I'll be probably creating a new v4 version soon, which will make better use of the new Weble/ZohoClient package, like i did for the crm package: https://github.com/Weble/ZohoCrmApi

orielsystems commented 4 years ago

Wow, that was a fast response. Thanks very much for that

Skullbock commented 4 years ago

No problem :) I was already on github so it was easy :)

Let me know if you encounter other issues

Skullbock commented 4 years ago

Hey @orielsystems just to notify you that i released v4 today with the new client, and an updated readme

orielsystems commented 4 years ago

Hi Daniele,

That's great thank you

Matt

Matthew Sidnell | Business Development Manager

T: +44 (0) 1249 705 079 | M: +44 (0) 7876 570 569 E: matt@orielsystems.com

The information in this email is confidential and solely for the use of the intended recipient(s). If you receive this email in error, please notify the sender and delete the email from your system immediately. In such circumstances, you must not make any use of the email or its contents. Views expressed by an individual in this email do not necessarily reflect the views of Oriel Systems Limited. Computer viruses may be transmitted by email. Oriel Systems Limited accepts no liability for any damage caused by any virus transmitted by this email. E-mail transmission cannot be guaranteed to be secure or error-free. It is possible that information may be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender does not accept liability for any errors or omissions in the contents of this message, which arise as a result of e-mail transmission. Oriel Systems Limited. Registered office: Unit 1 Industry Park, Cricketts Lane, Chippenham, Wiltshire, SN15 3EQ. Registered in England. Registered number: 01863005.


From: Daniele Rosario notifications@github.com Sent: Thursday, April 9, 2020 5:59:17 PM To: Weble/ZohoBooksApi ZohoBooksApi@noreply.github.com Cc: Oriel Systems matt@orielsystems.com; Mention mention@noreply.github.com Subject: Re: [Weble/ZohoBooksApi] New ZohoBooks Class Requires 3 Arguments (#44)

Hey @orielsystemshttps://github.com/orielsystems just to notify you that i released v4 today with the new client, and an updated readme

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://github.com/Weble/ZohoBooksApi/issues/44#issuecomment-611637364, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AJA5DK7GWMDMMZDET7ODE7DRLX5GLANCNFSM4MD2FGBA.