-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOrganization.php
62 lines (47 loc) · 1.08 KB
/
Organization.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
/**
* Created by PhpStorm.
* User: ExE
* Date: 07.02.17
* Time: 19:12
*/
require_once "APIObject.php";
class Organization extends APIObject
{
public $id;
public $name;
public $created_at;
public $updated_at;
public $pipes; //[Pipe]
/**
* @param null $data
*/
function __construct($data = null) {
if ($data != null) {
$this->assign_results($data);
}
}
/**
* @param null $phase_id int
* @return $this
*/
public function fetch($org_id = null) {
if ($org_id == null)
$org_id = $this->id;
$resp = $this->send_get("https://app.pipefy.com/organizations/$org_id.json", null, null);
$this->assign_results($resp);
$this->parse_property("pipes", "Pipe");
return $this;
}
/**
* @param $phase_name string
* @return Pipe
*/
public function get_pipe_by_name($pipe_name) {
foreach ($this->pipes as $pipe) {
if ($pipe->name == $pipe_name)
return $pipe;
}
return false;
}
}