Estimates::getPriceEstimates()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 1
crap 1
1
<?php namespace Stevenmaguire\Uber\Resources;
2
3
trait Estimates
4
{
5
    /**
6
     * Fetches a price estimate.
7
     *
8
     * The Price Estimates endpoint returns an estimated price range for each
9
     * product offered at a given location. The price estimate is provided as
10
     * a formatted string with the full price range and the localized currency
11
     * symbol.
12
     *
13
     * @param    array    $attributes   Query attributes
14
     *
15
     * @return   stdClass               The JSON response from the request
16
     *
17
     * @see      https://developer.uber.com/docs/riders/references/api/v1.2/estimates-price-get
18
     */
19 2
    public function getPriceEstimates($attributes = [])
20
    {
21 2
        return $this->request('get', 'estimates/price', $attributes);
22
    }
23
24
    /**
25
     * Fetches a time estimate.
26
     *
27
     * The Time Estimates endpoint returns ETAs for all products offered at a
28
     * given location, with the responses expressed as integers in seconds. We
29
     * recommend that this endpoint be called every minute to provide the most
30
     * accurate, up-to-date ETAs.
31
     *
32
     * @param    array    $attributes   Query attributes
33
     *
34
     * @return   stdClass               The JSON response from the request
35
     *
36
     * @see      https://developer.uber.com/docs/riders/references/api/v1.2/estimates-time-get
37
     */
38 2
    public function getTimeEstimates($attributes = [])
39
    {
40 2
        return $this->request('get', 'estimates/time', $attributes);
41
    }
42
43
    /**
44
     * Makes a request to the Uber API and returns the response.
45
     *
46
     * @param    string $verb       The Http verb to use
47
     * @param    string $path       The path of the APi after the domain
48
     * @param    array  $parameters Parameters
49
     *
50
     * @return   stdClass The JSON response from the request
51
     * @throws   Exception
52
     */
53
    abstract protected function request($verb, $path, $parameters = []);
54
}
55