Reminders   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 82
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 1
cbo 0
dl 0
loc 82
ccs 8
cts 8
cp 1
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A cancelReminder() 0 4 1
A createReminder() 0 4 1
A getReminder() 0 4 1
request() 0 1 ?
A setReminder() 0 4 1
1
<?php namespace Stevenmaguire\Uber\Resources;
2
3
trait Reminders
4
{
5
    /**
6
     * Cancels a specific reminder.
7
     *
8
     * The Reminders endpoint allows you to remove any reminder in the pending
9
     * state from being sent.
10
     *
11
     * @param    string   $reminderId   Reminder id
12
     *
13
     * @return   stdClass               The JSON response from the request
14
     *
15
     * @see      https://developer.uber.com/docs/riders/references/api/v1.2/reminders-reminder_id-delete
16
     */
17 2
    public function cancelReminder($reminderId)
18
    {
19 2
        return $this->request('delete', 'reminders/'.$reminderId);
20
    }
21
22
    /**
23
     * Creates a new reminder.
24
     *
25
     * The Reminders endpoint allows developers to set a reminder for a future
26
     * trip.
27
     *
28
     * @param    array    $attributes   Query attributes
29
     *
30
     * @return   stdClass               The JSON response from the request
31
     *
32
     * @see      https://developer.uber.com/docs/riders/references/api/v1.2/reminders-post
33
     */
34 2
    public function createReminder($attributes)
35
    {
36 2
        return $this->request('post', 'reminders', $attributes);
37
    }
38
39
    /**
40
     * Fetches a specific reminder.
41
     *
42
     * The Reminders endpoint allows you to get the status of an existing ride
43
     * reminder.
44
     *
45
     * @param    string   $reminderId   Reminder id
46
     *
47
     * @return   stdClass               The JSON response from the request
48
     *
49
     * @see      https://developer.uber.com/docs/riders/references/api/v1.2/reminders-reminder_id-get
50
     */
51 2
    public function getReminder($reminderId)
52
    {
53 2
        return $this->request('get', 'reminders/'.$reminderId);
54
    }
55
56
    /**
57
     * Makes a request to the Uber API and returns the response.
58
     *
59
     * @param    string $verb       The Http verb to use
60
     * @param    string $path       The path of the APi after the domain
61
     * @param    array  $parameters Parameters
62
     *
63
     * @return   stdClass The JSON response from the request
64
     * @throws   Exception
65
     */
66
    abstract protected function request($verb, $path, $parameters = []);
67
68
    /**
69
     * Updates a specific reminder.
70
     *
71
     * The Reminders endpoint allows you to update an existing reminder.
72
     *
73
     * @param string      $reminderId   Reminder id
74
     * @param array       $attributes   Query attributes
75
     *
76
     * @return  stdClass                The JSON response from the request
77
     *
78
     * @see     https://developer.uber.com/docs/riders/references/api/v1.2/reminders-reminder_id-patch
79
     */
80 2
    public function setReminder($reminderId, $attributes = [])
81
    {
82 2
        return $this->request('patch', 'reminders/'.$reminderId, $attributes);
83
    }
84
}
85