Permalink
Browse files

added connect_token handlers

  • Loading branch information...
1 parent 3ff06b4 commit 5bb2142ab678406799f7014320949b3a0b380007 @dominikgehl dominikgehl committed Aug 3, 2011
Showing with 54 additions and 0 deletions.
  1. +54 −0 class.contextio.php
View
@@ -85,6 +85,60 @@ public function discovery($params) {
/**
*
+ * @link http://context.io/docs/2.0/connecttokens
+ */
+ public function listConnectTokens() {
+ return $this->get(null, 'connect_tokens');
+ }
+
+ /**
+ *
+ * @link http://context.io/docs/2.0/connecttokens
+ */
+ public function getConnectToken($params) {
+ if (is_string($params)) {
+ $params = array('token' => $params);
+ }
+ else {
+ $params = $this->_filterParams($params, array('token'));
+ if ($params === false) {
+ throw new InvalidArgumentException("params array contains invalid parameters or misses required parameters");
+ }
+ }
+ return $this->get(null, 'connect_tokens/' . $params['token']);
+ }
+
+ /**
+ *
+ * @link http://context.io/docs/2.0/connecttokens
+ */
+ public function addConnectToken($params=array()) {
+ $params = $this->_filterParams($params, array('service_level','email','callback_url'), array('service_level','callback_url'));
+ if ($params === false) {
+ throw new InvalidArgumentException("params array contains invalid parameters or misses required parameters");
+ }
+ return $this->post(null, 'connect_tokens', $params);
+ }
+
+ /**
+ *
+ * @link http://context.io/docs/2.0/connecttokens
+ */
+ public function deleteConnectToken($params) {
+ if (is_string($params)) {
+ $params = array('token' => $params);
+ }
+ else {
+ $params = $this->_filterParams($params, array('token'), array('token'));
+ if ($params === false) {
+ throw new InvalidArgumentException("params array contains invalid parameters or misses required parameters");
+ }
+ }
+ return $this->delete(null, 'connect_tokens/' . $params['token']);
+ }
+
+ /**
+ *
* @link http://context.io/docs/2.0/oauthproviders
*/
public function listOAuthProviders() {

0 comments on commit 5bb2142

Please sign in to comment.