Completed
Pull Request — master (#30)
by Romain
02:57 queued 31s
created

Insights::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 2
crap 1
1
<?php
2
namespace Kerox\Messenger\Api;
3
4
use GuzzleHttp\ClientInterface;
5
use Kerox\Messenger\Request\InsightsRequest;
6
use Kerox\Messenger\Response\InsightsResponse;
7
8
class Insights extends AbstractApi
9
{
10
11
    /**
12
     * Insights constructor.
13
     *
14
     * @param string $pageToken
15
     * @param \GuzzleHttp\ClientInterface $client
16
     */
17 3
    public function __construct($pageToken, ClientInterface $client)
18
    {
19 3
        parent::__construct($pageToken, $client);
20 3
    }
21
22
    /**
23
     * @return \Kerox\Messenger\Response\InsightsResponse
24
     */
25 2
    public function threads(): InsightsResponse
26
    {
27 2
        $request = new InsightsRequest($this->pageToken);
28 2
        $response = $this->client->get('me/insights/page_messages_active_threads_unique', $request->build());
29
30 2
        return new InsightsResponse($response);
31
    }
32
33
    /**
34
     * @return \Kerox\Messenger\Response\InsightsResponse
35
     */
36
    public function feedback(): InsightsResponse
37
    {
38
        $request = new InsightsRequest($this->pageToken);
39
        $response = $this->client->get('me/insights/page_messages_feedback_by_action_unique', $request->build());
40
41
        return new InsightsResponse($response);
42
    }
43
}
44