jforrest / Chargify-PHP-Client

PHP client for Chargify
Please let me know if you have any questions.
MIT License
19 stars 16 forks source link

JSON / XML not balanced #12

Open CaptainYarb opened 12 years ago

CaptainYarb commented 12 years ago

There is a lot of this API class that is forced to use XML (such as getting all subscriptions) which is kinda silly.

Why doesn't this class operate the same between 1 extended class rather than 8 different ones?

Example:

[MAIN CLASS] $chargify = new Chargify($APIKEY,$DOMAINKEY,$RESPONSE='JSON'); [BUILD REQUEST] $chargify->subscriptions->getAll(); [GET REQUEST] $chargify->getRequest(); // already in format

done

current format

[EXTERNAL CLASS $subscriptions = new ChargifySubscription(); OPENS MAIN CLASS] $this->connector = new ChargifyConnector($test_mode); // wut? [BUILD REQUEST $subscriptions->getAll($vars['page'],$vars['perpage']); SET RESPONSE TYPE] // why should each function define it?? This is a global setting!!! GRRRR [GET DATA] $customers = $subscriptions->getXML(); // seemingly unnecessary

jforrest commented 12 years ago

Blazedd,

If you want to work with the raw XML or JSON data, then you only need to use the ChargifyConnector class and can ignore the rest. The rest are just convenience to avoid the raw output.

Let me know if this works for you, Jason