1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/* |
4
|
|
|
* This file is part of Laravel WuBook. |
5
|
|
|
* |
6
|
|
|
* (c) Filippo Galante <[email protected]> |
7
|
|
|
* |
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
9
|
|
|
* file that was distributed with this source code. |
10
|
|
|
*/ |
11
|
|
|
|
12
|
|
|
namespace IlGala\LaravelWubook\Api; |
13
|
|
|
|
14
|
|
|
use IlGala\LaravelWubook\Api\WuBookApi; |
15
|
|
|
|
16
|
|
|
/** |
17
|
|
|
* This is the WuBook rooms api class. |
18
|
|
|
* |
19
|
|
|
* @author Filippo Galante <[email protected]> |
20
|
|
|
*/ |
21
|
|
|
class WuBookRooms extends WuBookApi |
22
|
|
|
{ |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* @var string |
26
|
|
|
*/ |
27
|
|
|
private $token; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* Create a new WuBookRooms Instance. |
31
|
|
|
*/ |
32
|
|
|
public function __construct($config, $cache, $client, $token = null) |
33
|
|
|
{ |
34
|
|
|
parent::__construct($config, $cache, $client); |
35
|
|
|
|
36
|
|
|
$this->token = $token; |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* http://tdocs.wubook.net/wired/rooms.html#fetch_rooms |
41
|
|
|
* |
42
|
|
|
* @param int $ancillary 0|1 |
43
|
|
|
* @return mixed |
44
|
|
|
*/ |
45
|
|
|
public function fetch_rooms($ancillary = 0) |
46
|
|
|
{ |
47
|
|
|
return $this->call_method($this->token, 'fetch_rooms', [$ancillary]); |
48
|
|
|
} |
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* http://tdocs.wubook.net/wired/rooms.html#new_room |
52
|
|
|
* http://tdocs.wubook.net/wired/rooms.html#new_virtual_room |
53
|
|
|
* |
54
|
|
|
* @param array $data |
55
|
|
|
* @return mixed |
56
|
|
|
*/ |
57
|
|
|
public function new_room($data, $virtual = false) |
58
|
|
|
{ |
59
|
|
|
if ($virtual) { |
60
|
|
|
return $this->call_method($this->token, 'new_virtual_room', $data); |
61
|
|
|
} else { |
62
|
|
|
return $this->call_method($this->token, 'new_room', $data); |
63
|
|
|
} |
64
|
|
|
} |
65
|
|
|
|
66
|
|
|
/** |
67
|
|
|
* http://tdocs.wubook.net/wired/rooms.html#mod_room |
68
|
|
|
* http://tdocs.wubook.net/wired/rooms.html#mod_virtual_room |
69
|
|
|
* |
70
|
|
|
* The method will return a boolean only if response has no error. |
71
|
|
|
* |
72
|
|
|
* @param array $data |
73
|
|
|
* @param array|boolean $virtual |
74
|
|
|
* @return mixed |
75
|
|
|
*/ |
76
|
|
|
public function mod_room($data, $virtual = false) |
77
|
|
|
{ |
78
|
|
|
if ($virtual) { |
79
|
|
|
return $this->call_method($this->token, 'mod_virtual_room', $data); |
80
|
|
|
} else { |
81
|
|
|
return $this->call_method($this->token, 'mod_room', $data); |
82
|
|
|
} |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* http://tdocs.wubook.net/wired/rooms.html#del_room |
87
|
|
|
* |
88
|
|
|
* The method will return a boolean only if response has no error. |
89
|
|
|
* |
90
|
|
|
* @param int $id |
91
|
|
|
* @return boolean|string |
92
|
|
|
*/ |
93
|
|
|
public function del_room($id) |
94
|
|
|
{ |
95
|
|
|
return $this->call_method($this->token, 'del_room', [$id]); |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
/** |
99
|
|
|
* http://tdocs.wubook.net/wired/rooms.html#room_images |
100
|
|
|
* |
101
|
|
|
* @param int $id |
102
|
|
|
* @return mixed |
103
|
|
|
*/ |
104
|
|
|
public function room_images($id) |
105
|
|
|
{ |
106
|
|
|
return $this->call_method($this->token, 'room_images', [$id]); |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
/** |
110
|
|
|
* http://tdocs.wubook.net/wired/rooms.html#push_update_activation |
111
|
|
|
* |
112
|
|
|
* The method will return a boolean only if response has no error. |
113
|
|
|
* |
114
|
|
|
* @param string $url |
115
|
|
|
* @return boolean|string |
116
|
|
|
*/ |
117
|
|
|
public function push_update_activation($url) |
118
|
|
|
{ |
119
|
|
|
return $this->call_method($this->token, 'push_update_activation', [$url]); |
120
|
|
|
} |
121
|
|
|
|
122
|
|
|
/** |
123
|
|
|
* http://tdocs.wubook.net/wired/rooms.html#push_update_url |
124
|
|
|
* |
125
|
|
|
* @return string |
126
|
|
|
*/ |
127
|
|
|
public function push_update_url() |
128
|
|
|
{ |
129
|
|
|
return $this->call_method($this->token, 'push_update_url'); |
130
|
|
|
} |
131
|
|
|
} |
132
|
|
|
|