Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 4
CRAP
0.00% covered (danger)
0.00%
0 / 12
SyncAccount
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 4
20
0.00% covered (danger)
0.00%
0 / 12
 getCeculaBalance
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 3
 getSubscriptionStatus
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 3
 getSimStatus
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 3
 refreshSIM
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 3
1<?php
2
3namespace CeculaSyncApiClient;
4
5use Requests;
6
7class SyncAccount extends SyncApiClient implements SyncAccountInterface
8{
9
10    /**
11     * Get Balance
12     * Fetches the balance from your cecula account. In event of non-delivery of sms or calls, this method should be
13     * used to confirm account balance.
14     *
15     * @return object {"balance": 2034.4}
16     */
17    public function getCeculaBalance(): object
18    {
19        $endpoint = sprintf("%s/%s", $this->apiManager->base, $this->apiManager->endpoints->account->getBalance->endpoint);
20        $response = Requests::get($endpoint, $this->requestHeader);
21        return json_decode($response->body);
22    }
23
24    /**
25     * Subscription Status
26     * This method could be used to detect the state of the subscription. States could be ACTIVE, INACTIVE, ...
27     *
28     * @return object {"subscriptionStatus": ACTIVE}
29     */
30    public function getSubscriptionStatus(): object
31    {
32        $endpoint = sprintf("%s/%s", $this->apiManager->base, $this->apiManager->endpoints->account->getSubscriptionStatus->endpoint);
33        $response = Requests::get($endpoint, $this->requestHeader);
34        return json_decode($response->body);
35    }
36
37    /**
38     * SIM Status
39     * This method returns the state of a SIM. Eg. READY, SENDING SMS, IN CALL, ...
40     *
41     * @param string $msisdn (optional) the target SIM
42     * @return object The state of the SIM. e.g. READY
43     */
44    public function getSimStatus(string $msisdn=""): object
45    {
46        $endpoint = sprintf("%s/%s", $this->apiManager->base, $this->apiManager->endpoints->account->getSimStatus->endpoint);
47        $response = Requests::get($endpoint, $this->requestHeader);
48        return json_decode($response->body);
49    }
50
51    /**
52     * Refresh SIM
53     * This method refreshes the sim in event where messages are frozen.
54     *
55     * @param string $msisdn (optional) the target SIM
56     * @return object {"status": "Successful"}
57     */
58    public function refreshSIM(string $msisdn=""): object
59    {
60        $endpoint = sprintf("%s/%s", $this->apiManager->base, $this->apiManager->endpoints->account->refreshSim->endpoint);
61        $response = Requests::get($endpoint, $this->requestHeader);
62        return json_decode($response->body);
63    }
64}