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
|
|
|
* Description of WuBookPrices |
18
|
|
|
* |
19
|
|
|
* @author Filippo Galante <[email protected]> |
20
|
|
|
*/ |
21
|
|
|
class WuBookPrices 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/prices.html#add_pricing_plan |
41
|
|
|
* |
42
|
|
|
* @param string $name |
43
|
|
|
* @param int $daily 0|1 |
44
|
|
|
* @return mixed |
45
|
|
|
*/ |
46
|
|
|
public function add_pricing_plan($name, $daily = 1) |
47
|
|
|
{ |
48
|
|
|
return $this->call_method($this->token, 'add_pricing_plan', [$name, $daily]); |
49
|
|
|
} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* http://tdocs.wubook.net/wired/prices.html#add_vplan |
53
|
|
|
* |
54
|
|
|
* @param string $name |
55
|
|
|
* @param int $id |
56
|
|
|
* @param int $dtype -2|-1|1|2 |
57
|
|
|
* @param float|int $value |
58
|
|
|
* @return mixed |
59
|
|
|
*/ |
60
|
|
|
public function add_vplan($name, $id, $dtype, $value) |
61
|
|
|
{ |
62
|
|
|
return $this->call_method($this->token, 'add_pricing_plan', [$name, $id, $dtype, $value]); |
63
|
|
|
} |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* http://tdocs.wubook.net/wired/prices.html#del_plan |
67
|
|
|
* |
68
|
|
|
* @param int $id |
69
|
|
|
* @return mixed |
70
|
|
|
*/ |
71
|
|
|
public function del_plan($id) |
72
|
|
|
{ |
73
|
|
|
return $this->call_method($this->token, 'del_plan', [$id]); |
74
|
|
|
} |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* http://tdocs.wubook.net/wired/prices.html#update_plan_name |
78
|
|
|
* |
79
|
|
|
* @param int $id |
80
|
|
|
* @param string $name |
81
|
|
|
* @return mixed |
82
|
|
|
*/ |
83
|
|
|
public function update_plan_name($id, $name) |
84
|
|
|
{ |
85
|
|
|
return $this->call_method($this->token, 'update_plan_name', [$id, $name]); |
86
|
|
|
} |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* http://tdocs.wubook.net/wired/prices.html#get_pricing_plans |
90
|
|
|
* |
91
|
|
|
* @return mixed |
92
|
|
|
*/ |
93
|
|
|
public function get_pricing_plans() |
94
|
|
|
{ |
95
|
|
|
return $this->call_method($this->token, 'get_pricing_plans'); |
96
|
|
|
} |
97
|
|
|
|
98
|
|
|
/** |
99
|
|
|
* http://tdocs.wubook.net/wired/prices.html#update_plan_rack |
100
|
|
|
* |
101
|
|
|
* @param int $id |
102
|
|
|
* @param array $rack |
103
|
|
|
* @return mixed |
104
|
|
|
*/ |
105
|
|
|
public function update_plan_rack($id, $rack) |
106
|
|
|
{ |
107
|
|
|
return $this->call_method($this->token, 'update_plan_rack', [$id, $rack]); |
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
/** |
111
|
|
|
* http://tdocs.wubook.net/wired/prices.html#mod_vplans |
112
|
|
|
* |
113
|
|
|
* @param array $plans |
114
|
|
|
* @return mixed |
115
|
|
|
*/ |
116
|
|
|
public function mod_vplans($plans) |
117
|
|
|
{ |
118
|
|
|
return $this->call_method($this->token, 'mod_vplans', [$plans]); |
119
|
|
|
} |
120
|
|
|
|
121
|
|
|
/** |
122
|
|
|
* http://tdocs.wubook.net/wired/prices.html#update_plan_prices |
123
|
|
|
* |
124
|
|
|
* @param int $id |
125
|
|
|
* @param string $dfrom |
126
|
|
|
* @param array $prices |
127
|
|
|
* @return mixed |
128
|
|
|
*/ |
129
|
|
|
public function update_plan_prices($id, $dfrom, $prices) |
130
|
|
|
{ |
131
|
|
|
return $this->call_method($this->token, 'update_plan_prices', [$id, $dfrom, $prices]); |
132
|
|
|
} |
133
|
|
|
|
134
|
|
|
/** |
135
|
|
|
* http://tdocs.wubook.net/wired/prices.html#fetch_plan_prices |
136
|
|
|
* |
137
|
|
|
* @param int $id |
138
|
|
|
* @param string $dfrom |
139
|
|
|
* @param string $dto |
140
|
|
|
* @param array $rooms |
141
|
|
|
* @return mixed |
142
|
|
|
*/ |
143
|
|
|
public function fetch_plan_prices($id, $dfrom, $dto, $rooms = []) |
|
|
|
|
144
|
|
|
{ |
145
|
|
|
return $this->call_method($this->token, 'fetch_plan_prices', [$id, $dfrom, $dto, $rooms = []]); |
146
|
|
|
} |
147
|
|
|
|
148
|
|
|
/** |
149
|
|
|
* http://tdocs.wubook.net/wired/prices.html#convert_to_daily_plan |
150
|
|
|
* |
151
|
|
|
* @param int $id |
152
|
|
|
* @return mixed |
153
|
|
|
*/ |
154
|
|
|
public function convert_to_daily_plan($id) |
155
|
|
|
{ |
156
|
|
|
return $this->call_method($this->token, 'convert_to_daily_plan', [$id]); |
157
|
|
|
} |
158
|
|
|
|
159
|
|
|
/** |
160
|
|
|
* http://tdocs.wubook.net/wired/prices.html#update_plan_periods |
161
|
|
|
* |
162
|
|
|
* @param int $id |
163
|
|
|
* @param array $periods |
164
|
|
|
* @return mixed |
165
|
|
|
*/ |
166
|
|
|
public function update_plan_periods($id, $periods) |
167
|
|
|
{ |
168
|
|
|
return $this->call_method($this->token, 'update_plan_periods', [$id, $periods]); |
169
|
|
|
} |
170
|
|
|
|
171
|
|
|
/** |
172
|
|
|
* http://tdocs.wubook.net/wired/prices.html#delete_periods |
173
|
|
|
* |
174
|
|
|
* @param int $id |
175
|
|
|
* @param array $periods |
176
|
|
|
* @return mixed |
177
|
|
|
*/ |
178
|
|
|
public function delete_periods($id, $periods) |
179
|
|
|
{ |
180
|
|
|
return $this->call_method($this->token, 'delete_periods', [$id, $periods]); |
181
|
|
|
} |
182
|
|
|
} |
183
|
|
|
|
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.