Skip to content

Commit

Permalink
Merge pull request #1 from podio/master
Browse files Browse the repository at this point in the history
updating to v4.3.0
  • Loading branch information
daniel-sc committed Oct 3, 2015
2 parents befbfe2 + 4360027 commit d8cbb8f
Show file tree
Hide file tree
Showing 6 changed files with 103 additions and 4 deletions.
16 changes: 16 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
4.3.0 / 2015-09-30
==================

* Add support for Flows (https://developers.podio.com/doc/flows)


4.2.0 / 2015-07-02
==================

* Add `update_reference` and `count` to `PodioTask`
* Create `PodioVoting`
* Add low memory file fetch
* Verify TLS certificates
* Minor bug fixes


4.1.0 / 2015-06-16
==================

Expand Down
1 change: 1 addition & 0 deletions PodioAPI.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
require_once 'models/PodioConversationParticipant.php';
require_once 'models/PodioEmbed.php';
require_once 'models/PodioFile.php';
require_once 'models/PodioFlow.php';
require_once 'models/PodioForm.php';
require_once 'models/PodioGrant.php';
require_once 'models/PodioHook.php';
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
This the official PHP Client for interacting with the Podio API. All parts of the Podio API are covered in this client. See [podio.github.io/podio-php](http://podio.github.io/podio-php) for documentation.

[![Build Status](https://travis-ci.org/podio/podio-php.svg?branch=4.0.0)](https://travis-ci.org/podio/podio-php)


[![Join the chat at https://gitter.im/podio/podio-php](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/podio/podio-php?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
14 changes: 10 additions & 4 deletions lib/Podio.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ class Podio {
protected static $url, $client_id, $client_secret, $secret, $ch, $headers;
private static $stdout;

const VERSION = '4.1.0';
const VERSION = '4.3.0';

const GET = 'GET';
const POST = 'POST';
Expand Down Expand Up @@ -41,9 +41,15 @@ public static function setup($client_id, $client_secret, $options = array('sessi
}

self::$session_manager = null;
if ($options && !empty($options['session_manager']) && class_exists($options['session_manager'])) {
self::$session_manager = new $options['session_manager'];
self::$oauth = self::$session_manager->get();
if ($options && !empty($options['session_manager'])) {
if (is_string($options['session_manager']) && class_exists($options['session_manager'])) {
self::$session_manager = new $options['session_manager'];
} else if (is_object($options['session_manager']) && method_exists($options['session_manager'], 'get') && method_exists($options['session_manager'], 'get')) {
self::$session_manager = $options['session_manager'];
}
if (self::$session_manager) {
self::$oauth = self::$session_manager->get();
}
}

// Register shutdown function for debugging and session management
Expand Down
1 change: 1 addition & 0 deletions models/PodioAppField.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ public function __construct($attributes = array()) {
$this->property('external_id', 'string');
$this->property('config', 'hash');
$this->property('status', 'string');
$this->property('label', 'string');

$this->init($attributes);
}
Expand Down
72 changes: 72 additions & 0 deletions models/PodioFlow.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?php
/**
* @see https://developers.podio.com/doc/flows
*/
class PodioFlow extends PodioObject {
public function __construct($attributes = array()) {
$this->property('flow_id', 'integer', array('id' => true));
$this->property('name', 'string');
$this->property('type', 'string');
$this->property('config', 'hash');
$this->property('effects', 'hash');

$this->init($attributes);
}

/**
* @see https://developers.podio.com/doc/flows/get-flow-by-id-26312313
*/
public static function get($flow_id) {
return Podio::get("/flow/{$flow_id}")->json_body();
}

/**
* @see https://developers.podio.com/doc/flows/add-new-flow-26309928
*/
public static function create($ref_type, $ref_id, $attributes = array()) {
return Podio::post("/flow/{$ref_type}/{$ref_id}/", $attributes);
}

/**
* @see https://developers.podio.com/doc/flows/update-flow-26310901
*/
public static function update($flow_id, $attributes = array()) {
return Podio::put("/flow/{$flow_id}", $attributes);
}

/**
* @see https://developers.podio.com/doc/flows/delete-flow-32929229
*/
public static function delete($flow_id) {
return Podio::delete("/flow/{$flow_id}");
}

/**
* @see https://developers.podio.com/doc/flows/get-flows-26312304
*/
public static function get_flows($ref_type, $ref_id) {
return Podio::get("/flow/{$ref_type}/{$ref_id}/")->json_body();
}

/**
* @see https://developers.podio.com/doc/flows/get-effect-attributes-239234961
*/
public static function get_effect_attributes($ref_type, $ref_id) {
return Podio::post("/flow/{$ref_type}/{$ref_id}/effect/attributes")->json_body();
}

/**
* @see https://developers.podio.com/doc/flows/get-flow-context-26313659
*/
public static function get_flow_context($flow_id) {
return Podio::get("/flow/{$flow_id}/context/")->json_body();
}

/**
* @see https://developers.podio.com/doc/flows/get-possible-attributes-33060379
*/
public static function get_possible_attributes($ref_type, $ref_id) {
return Podio::post("/flow/{$ref_type}/{$ref_id}/attributes/")->json_body();
}

}

0 comments on commit d8cbb8f

Please sign in to comment.