1 | <?php |
||
10 | class NotificationPreferences extends MoipResource |
||
11 | { |
||
12 | /** |
||
13 | * Path accounts API. |
||
14 | * |
||
15 | * @const string |
||
16 | */ |
||
17 | const PATH = 'preferences'; |
||
18 | |||
19 | /** |
||
20 | * Notification media. |
||
21 | * |
||
22 | * @var string |
||
23 | */ |
||
24 | const NOTIFICATION_MEDIA = 'WEBHOOK'; |
||
25 | |||
26 | /** |
||
27 | * Initialize a new instance. |
||
28 | */ |
||
29 | public function initialize() |
||
35 | |||
36 | /** |
||
37 | * Add a new address to the account. |
||
38 | * |
||
39 | * @param string $event Webhook. |
||
40 | * |
||
41 | * @return $this |
||
42 | */ |
||
43 | public function addEvent($event) |
||
49 | |||
50 | /** |
||
51 | * Set target to notification. |
||
52 | * |
||
53 | * @param string $target Notification URL. |
||
54 | * |
||
55 | * @return $this |
||
56 | */ |
||
57 | public function setTarget($target) |
||
63 | |||
64 | /** |
||
65 | * Returns target. |
||
66 | * |
||
67 | * @return string |
||
68 | */ |
||
69 | public function getTarget() |
||
73 | |||
74 | /** |
||
75 | * Returns media. |
||
76 | * |
||
77 | * @return string |
||
78 | */ |
||
79 | public function getMedia() |
||
83 | |||
84 | /** |
||
85 | * Returns events. |
||
86 | * |
||
87 | * @return array |
||
88 | */ |
||
89 | public function getEvents() |
||
90 | { |
||
91 | return $this->data->events; |
||
92 | } |
||
93 | |||
94 | /** |
||
95 | * Returns notification id. |
||
96 | * |
||
97 | * @return stdClass |
||
98 | */ |
||
99 | public function getId() |
||
100 | { |
||
101 | return $this->data->id; |
||
102 | } |
||
103 | |||
104 | /** |
||
105 | * Returns notification token. |
||
106 | * |
||
107 | * @return stdClass |
||
108 | */ |
||
109 | public function getToken() |
||
110 | { |
||
111 | return $this->data->token; |
||
112 | } |
||
113 | |||
114 | /** |
||
115 | * Create a new notification preference. |
||
116 | * |
||
117 | * @return \stdClass |
||
118 | */ |
||
119 | public function create() |
||
120 | { |
||
121 | return $this->createResource($this->generatePath('notifications')); |
||
122 | } |
||
123 | |||
124 | /** |
||
125 | * Get a notification preference. |
||
126 | * |
||
127 | * @param string $notification_id Moip notification id. |
||
128 | * |
||
129 | * @return stdClass |
||
130 | */ |
||
131 | public function get($notification_id) |
||
135 | |||
136 | /** |
||
137 | * Create a new Notifications List instance. |
||
138 | * |
||
139 | * @return \Moip\Resource\NotificationPreferencesList |
||
140 | */ |
||
141 | public function getList() |
||
147 | |||
148 | /** |
||
149 | * Delete. |
||
150 | * |
||
151 | * @param $notification_id |
||
152 | * |
||
153 | * @return mixed |
||
154 | */ |
||
155 | public function delete($notification_id) |
||
159 | |||
160 | /** |
||
161 | * Mount the notification preference structure. |
||
162 | * |
||
163 | * @param \stdClass $response |
||
164 | * |
||
165 | * @return \Moip\Resource\NotificationPreferences data |
||
166 | */ |
||
167 | protected function populate(stdClass $response) |
||
178 | } |
||
179 |