forked from andrewscofield/parse.com-php-library
-
Notifications
You must be signed in to change notification settings - Fork 0
/
parseCloud.php
43 lines (39 loc) · 954 Bytes
/
parseCloud.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
<?php
/*
// Adding the possibility to run parse cloud code functions
$cloud = new parseCloud("functionName");
// Setting the params
$cloud->__set('action',1234);
$cloud->__set('identifier',"aZ02fe2a");
// Running the cloud function
$result = $cloud->run();
print_r($result);
*/
class parseCloud extends parseRestClient{
public $_options;
private $_functionName = '';
public function __construct($function=''){
$this->_options = array();
if($function != ''){
$this->_functionName = $function;
}
else{
$this->throwError('include the functionName when creating a parseCloud');
}
parent::__construct();
}
public function __set($name,$value){
$this->_options[$name] = $value;
}
public function run(){
if($this->_functionName != ''){
$request = $this->request(array(
'method' => 'POST',
'requestUrl' => 'functions/'.$this->_functionName,
'data' => $this->_options,
));
return $request;
}
}
}
?>