@@ 58-69 (lines=12) @@ | ||
55 | * |
|
56 | * @return mixed |
|
57 | */ |
|
58 | public function createAccount($params) |
|
59 | { |
|
60 | // Http request |
|
61 | $response = $this->adapter->post(sprintf('%s/account', $this->endpoint), $params); |
|
62 | ||
63 | // Result |
|
64 | if ($this->content_type == 'application/json') { |
|
65 | return json_decode($response); |
|
66 | } else { |
|
67 | return $response; |
|
68 | } |
|
69 | } |
|
70 | ||
71 | /** |
|
72 | * Get current credits. |
|
@@ 76-87 (lines=12) @@ | ||
73 | * |
|
74 | * @return mixed |
|
75 | */ |
|
76 | public function credits() |
|
77 | { |
|
78 | // Http request |
|
79 | $response = $this->adapter->get(sprintf('%s/credits', $this->endpoint)); |
|
80 | ||
81 | // Result |
|
82 | if ($this->content_type == 'application/json') { |
|
83 | return json_decode($response); |
|
84 | } else { |
|
85 | return $response; |
|
86 | } |
|
87 | } |
|
88 | ||
89 | /** |
|
90 | * Send or simulate sending of single or multiple SMSs. |
|
@@ 173-184 (lines=12) @@ | ||
170 | * |
|
171 | * @return mixed |
|
172 | */ |
|
173 | public function delete($id) |
|
174 | { |
|
175 | // Http request |
|
176 | $response = $this->adapter->delete(sprintf('%s/send/%d', $this->endpoint, $id)); |
|
177 | ||
178 | // Result |
|
179 | if ($this->content_type == 'application/json') { |
|
180 | return json_decode($response); |
|
181 | } else { |
|
182 | return $response; |
|
183 | } |
|
184 | } |
|
185 | ||
186 | /** |
|
187 | * Create or update a contact list. |
|
@@ 191-202 (lines=12) @@ | ||
188 | * |
|
189 | * @return mixed |
|
190 | */ |
|
191 | public function contactList($params) |
|
192 | { |
|
193 | // Http request |
|
194 | $response = $this->adapter->post(sprintf('%s/list', $this->endpoint), $params); |
|
195 | ||
196 | // Result |
|
197 | if ($this->content_type == 'application/json') { |
|
198 | return json_decode($response); |
|
199 | } else { |
|
200 | return $response; |
|
201 | } |
|
202 | } |
|
203 | ||
204 | /** |
|
205 | * Retrieve contact lists. |
|
@@ 232-243 (lines=12) @@ | ||
229 | * |
|
230 | * @return mixed |
|
231 | */ |
|
232 | public function deduplicate($id) |
|
233 | { |
|
234 | $response = $this->adapter->put(sprintf('%s/deduplicate/%d', $this->endpoint, $id)); |
|
235 | ||
236 | // Result |
|
237 | if ($this->content_type == 'application/json') { |
|
238 | return json_decode($response); |
|
239 | } else { |
|
240 | return $response; |
|
241 | } |
|
242 | } |
|
243 | ||
244 | /** |
|
245 | * @return mixed |
|
246 | */ |
|
@@ 247-258 (lines=12) @@ | ||
244 | /** |
|
245 | * @return mixed |
|
246 | */ |
|
247 | public function deleteContact($id) |
|
248 | { |
|
249 | $response = $this->adapter->delete(sprintf('%s/list/contact/%d', $this->endpoint, $id)); |
|
250 | ||
251 | // Result |
|
252 | if ($this->content_type == 'application/json') { |
|
253 | return json_decode($response); |
|
254 | } else { |
|
255 | return $response; |
|
256 | } |
|
257 | } |
|
258 | ||
259 | /** |
|
260 | * Retrieve blacklist contacts. |
|
261 | * |
|
@@ 264-275 (lines=12) @@ | ||
261 | * |
|
262 | * @return mixed |
|
263 | */ |
|
264 | public function getBlacklist() |
|
265 | { |
|
266 | // Http request |
|
267 | $response = $this->adapter->get(sprintf('%s/blacklist', $this->endpoint)); |
|
268 | ||
269 | // Result |
|
270 | if ($this->content_type == 'application/json') { |
|
271 | return json_decode($response); |
|
272 | } else { |
|
273 | return $response; |
|
274 | } |
|
275 | } |
|
276 | ||
277 | /** |
|
278 | * @return mixed |
|
@@ 280-290 (lines=11) @@ | ||
277 | /** |
|
278 | * @return mixed |
|
279 | */ |
|
280 | public function deliveryReport($params) |
|
281 | { |
|
282 | if ($this->content_type == 'application/json') { |
|
283 | throw new SMSFactorException("Delivery report is available accepts only XML"); |
|
284 | } |
|
285 | ||
286 | $response = $this->adapter->post(sprintf('%s/dr', $this->endpoint), $params); |
|
287 | ||
288 | // Result |
|
289 | return $response; |
|
290 | } |
|
291 | ||
292 | private function isValidDate($date) |
|
293 | { |