Skip to content

Commit dbd16bb

Browse files
Merge pull request #12 from stevenmaguire/support-version-1.2
Support version 1.2
2 parents 68fd8db + 2681913 commit dbd16bb

8 files changed

+794
-84
lines changed

.scrutinizer.yml

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ checks:
1919
tools:
2020
external_code_coverage:
2121
timeout: 600
22+
runs: 2
2223
php_analyzer: true
2324
php_code_coverage: false
2425
php_code_sniffer:

.travis.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ script:
1616
- ./vendor/bin/phpunit --coverage-text --coverage-clover=coverage.clover
1717

1818
after_script:
19-
- wget https://scrutinizer-ci.com/ocular.phar
20-
- php ocular.phar code-coverage:upload --format=php-clover coverage.clover
19+
- if [ "$TRAVIS_PHP_VERSION" != "hhvm" ] && [ "$TRAVIS_PHP_VERSION" != "7.0" ]; then wget https://scrutinizer-ci.com/ocular.phar; fi
20+
- if [ "$TRAVIS_PHP_VERSION" != "hhvm" ] && [ "$TRAVIS_PHP_VERSION" != "7.0" ]; then php ocular.phar code-coverage:upload --format=php-clover coverage.clover; fi

CHANGELOG.md

+31
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,37 @@
11
# Changelog
22
All Notable changes to `uber-php` will be documented in this file
33

4+
## 1.5.0 - 2016-11-21
5+
6+
### Added
7+
- Update rate limit parser to fail gracefully when no headers returned, as is expected in Uber API v1.2
8+
- Update default api version to v1.2
9+
- Add profile patch support
10+
- Add payment methods list support
11+
- Add place detail support
12+
- Add update place support
13+
- Add current ride request detail support
14+
- Add update current ride request support
15+
- Update sandbox method names to include intent
16+
- Add update specific request support
17+
- Add create reminder support
18+
- Add fetch reminder support
19+
- Add update reminder support
20+
- Add cancel reminder support
21+
- Add raised exception when invoking sandbox methods on non-sandbox client
22+
23+
### Deprecated
24+
- Removed `setProduct` method, replaced with `setSandboxProduct`
25+
26+
### Fixed
27+
- Nothing
28+
29+
### Removed
30+
- Nothing
31+
32+
### Security
33+
- Nothing
34+
435
## 1.4.0 - 2015-07-08
536

637
### Added

CONTRIBUTING.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,14 @@ We accept contributions via Pull Requests on [Github](https://github.com/stevenm
2525
## Running Tests
2626

2727
``` bash
28-
$ phpunit
28+
$ ./vendor/bin/phpunit
29+
```
30+
31+
32+
## Running PHP Code Sniffer
33+
34+
``` bash
35+
$ ./vendor/bin/phpcs src --standard=psr2 -sp
2936
```
3037

3138

README.md

+171-14
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ $client = new Stevenmaguire\Uber\Client(array(
3030
'access_token' => 'YOUR ACCESS TOKEN',
3131
'server_token' => 'YOUR SERVER TOKEN',
3232
'use_sandbox' => true, // optional, default false
33-
'version' => 'v1', // optional, default 'v1'
33+
'version' => 'v1.2', // optional, default 'v1.2'
3434
'locale' => 'en_US', // optional, default 'en_US'
3535
));
3636
```
@@ -104,7 +104,6 @@ $history = $client->getHistory(array(
104104
```
105105

106106
[https://developer.uber.com/v1/endpoints/#user-activity-v1-1](https://developer.uber.com/v1/endpoints/#user-activity-v1-1)
107-
[https://developer.uber.com/v1/endpoints/#user-activity-v1-2](https://developer.uber.com/v1/endpoints/#user-activity-v1-2)
108107

109108
### Get User Profile
110109

@@ -114,6 +113,44 @@ $profile = $client->getProfile();
114113

115114
[https://developer.uber.com/v1/endpoints/#user-profile](https://developer.uber.com/v1/endpoints/#user-profile)
116115

116+
### Update User Profile
117+
118+
```php
119+
$attributes = ['applied_promotion_codes' => 'PROMO_CODE'];
120+
$profileResponse = $client->setProfile($attributes);
121+
```
122+
123+
[https://developer.uber.com/docs/riders/references/api/v1.2/me-patch](https://developer.uber.com/docs/riders/references/api/v1.2/me-patch)
124+
125+
### Get Payment Methods
126+
127+
```php
128+
$paymentMethods = $client->getPaymentMethods();
129+
```
130+
131+
[https://developer.uber.com/docs/riders/references/api/v1.2/payment-methods-get](https://developer.uber.com/docs/riders/references/api/v1.2/payment-methods-get)
132+
133+
### Get Place
134+
135+
```php
136+
$placeId = 'home';
137+
138+
$place = $client->getPlace($placeId);
139+
```
140+
141+
[https://developer.uber.com/docs/riders/references/api/v1.2/places-place_id-get](https://developer.uber.com/docs/riders/references/api/v1.2/places-place_id-get)
142+
143+
### Update a Place
144+
145+
```php
146+
$placeId = 'home';
147+
$attributes = ['address' => '685 Market St, San Francisco, CA 94103, USA'];
148+
149+
$place = $client->setPlace($placeId, $attributes);
150+
```
151+
152+
[https://developer.uber.com/docs/riders/references/api/v1.2/places-place_id-put](https://developer.uber.com/docs/riders/references/api/v1.2/places-place_id-put)
153+
117154
### Request A Ride
118155

119156
```php
@@ -148,14 +185,55 @@ try {
148185

149186
[https://developer.uber.com/v1/endpoints/#request](https://developer.uber.com/v1/endpoints/#request)
150187

188+
### Get Current Ride Details
189+
190+
```php
191+
$request = $client->getCurrentRequest();
192+
```
193+
194+
[https://developer.uber.com/docs/riders/references/api/v1.2/requests-current-get](https://developer.uber.com/docs/riders/references/api/v1.2/requests-current-get)
195+
151196
### Get Ride Details
152197

153198
```php
154-
$request = $client->getRequest($request_id);
199+
$request = $client->getRequest($requestId);
155200
```
156201

157202
[https://developer.uber.com/v1/endpoints/#request-details](https://developer.uber.com/v1/endpoints/#request-details)
158203

204+
### Update Current Ride Details
205+
206+
```php
207+
$requestDetails = array(
208+
'end_address' => '685 Market St, San Francisco, CA 94103, USA',
209+
'end_nickname' => 'da crib',
210+
'end_place_id' => 'home',
211+
'end_latitude' => '41.87499492',
212+
'end_longitude' => '-87.67126465'
213+
);
214+
215+
$updateRequest = $client->setCurrentRequest($requestDetails);
216+
```
217+
218+
[https://developer.uber.com/docs/riders/references/api/v1.2/requests-current-patch](https://developer.uber.com/docs/riders/references/api/v1.2/requests-current-patch)
219+
220+
### Update Ride Details
221+
222+
```php
223+
$requestId = '4bfc6c57-98c0-424f-a72e-c1e2a1d49939'
224+
$requestDetails = array(
225+
'end_address' => '685 Market St, San Francisco, CA 94103, USA',
226+
'end_nickname' => 'da crib',
227+
'end_place_id' => 'home',
228+
'end_latitude' => '41.87499492',
229+
'end_longitude' => '-87.67126465'
230+
);
231+
232+
$updateRequest = $client->setRequest($requestId, $requestDetails);
233+
```
234+
235+
[https://developer.uber.com/docs/riders/references/api/v1.2/requests-request_id-patch](https://developer.uber.com/docs/riders/references/api/v1.2/requests-request_id-patch)
236+
159237
### Get Ride Estimate
160238

161239
```php
@@ -173,41 +251,118 @@ $requestEstimate = $client->getRequestEstimate(array(
173251
### Get Ride Map
174252

175253
```php
176-
$map = $client->getRequestMap($request_id);
254+
$map = $client->getRequestMap($requestId);
177255
```
178256

179257
[https://developer.uber.com/v1/endpoints/#request-map](https://developer.uber.com/v1/endpoints/#request-map)
180258

181259
### Get Ride Receipt
182260

183261
```php
184-
$receipt = $client->getRequestReceipt($request_id);
262+
$receipt = $client->getRequestReceipt($requestId);
185263
```
186264

187265
[https://developer.uber.com/v1/endpoints/#request-receipt](https://developer.uber.com/v1/endpoints/#request-receipt)
188266

267+
### Cancel Current Ride
268+
269+
```php
270+
$request = $client->cancelCurrentRequest();
271+
```
272+
273+
[https://developer.uber.com/docs/riders/references/api/v1.2/requests-current-delete](https://developer.uber.com/docs/riders/references/api/v1.2/requests-current-delete)
274+
189275
### Cancel Ride
190276

191277
```php
192-
$request = $client->cancelRequest($request_id);
278+
$request = $client->cancelRequest($requestId);
193279
```
194280

195281
[https://developer.uber.com/v1/endpoints/#request-cancel](https://developer.uber.com/v1/endpoints/#request-cancel)
196282

283+
### Create Reminder
284+
285+
```php
286+
$attributes = [
287+
'reminder_time' => '1429294463',
288+
'phone_number' => '555-555-5555',
289+
'event' => [
290+
'time' => '1429294463',
291+
'name' => 'Frisbee with friends',
292+
'location' => 'Dolores Park',
293+
'latitude' => '37.759773',
294+
'longitude' => '-122.427063',
295+
],
296+
'product_id' => 'a1111c8c-c720-46c3-8534-2fcdd730040d',
297+
'trip_branding' => [
298+
'link_text' => 'View team roster',
299+
'partner_deeplink' => 'partner://team/9383',
300+
]
301+
];
302+
$reminder = $client->createReminder($attributes);
303+
```
304+
305+
[https://developer.uber.com/docs/riders/references/api/v1.2/reminders-post](https://developer.uber.com/docs/riders/references/api/v1.2/reminders-post)
306+
307+
### Get Reminder
308+
309+
```php
310+
$reminderId = '4bfc6c57-98c0-424f-a72e-c1e2a1d49939';
311+
$reminder = $client->getReminder($reminderId);
312+
```
313+
314+
[https://developer.uber.com/docs/riders/references/api/v1.2/reminders-reminder_id-get](https://developer.uber.com/docs/riders/references/api/v1.2/reminders-reminder_id-get)
315+
316+
### Update Reminder
317+
318+
```php
319+
$reminderId = '4bfc6c57-98c0-424f-a72e-c1e2a1d49939';
320+
$attributes = [
321+
'reminder_time' => '1429294463',
322+
'phone_number' => '555-555-5555',
323+
'event' => [
324+
'time' => '1429294463',
325+
'name' => 'Frisbee with friends',
326+
'location' => 'Dolores Park',
327+
'latitude' => '37.759773',
328+
'longitude' => '-122.427063',
329+
],
330+
'product_id' => 'a1111c8c-c720-46c3-8534-2fcdd730040d',
331+
'trip_branding' => [
332+
'link_text' => 'View team roster',
333+
'partner_deeplink' => 'partner://team/9383',
334+
]
335+
];
336+
$reminder = $client->setReminder($reminderId, $attributes);
337+
```
338+
339+
[https://developer.uber.com/docs/riders/references/api/v1.2/reminders-reminder_id-patch](https://developer.uber.com/docs/riders/references/api/v1.2/reminders-reminder_id-patch)
340+
341+
### Cancel Reminder
342+
343+
```php
344+
$reminderId = '4bfc6c57-98c0-424f-a72e-c1e2a1d49939';
345+
$reminder = $client->cancelReminder($reminderId);
346+
```
347+
348+
[https://developer.uber.com/docs/riders/references/api/v1.2/reminders-reminder_id-delete](https://developer.uber.com/docs/riders/references/api/v1.2/reminders-reminder_id-delete)
349+
197350
### Rate Limiting
198351

352+
> This feature is only supported for `v1` version of the API.
353+
199354
Rate limiting is implemented on the basis of a specific client's secret token. By default, 1,000 requests per hour can be made per secret token.
200355

201356
When consuming the service with this package, your rate limit status will be made available within the client.
202357

203358
```php
204-
$product = $client->getProduct($product_id);
359+
$product = $client->getProduct($productId);
205360

206-
$rate_limit = $client->getRateLimit();
361+
$rateLimit = $client->getRateLimit();
207362

208-
$rate_limit->getLimit(); // Rate limit capacity per period
209-
$rate_limit->getRemaining(); // Requests remaining in current period
210-
$rate_limit->getReset(); // Timestamp in UTC time when the next period will begin
363+
$rateLimit->getLimit(); // Rate limit capacity per period
364+
$rateLimit->getRemaining(); // Requests remaining in current period
365+
$rateLimit->getReset(); // Timestamp in UTC time when the next period will begin
211366
```
212367
These values will update after each request. `getRateLimit` will return null after the client is created and before the first successful request.
213368

@@ -217,6 +372,8 @@ These values will update after each request. `getRateLimit` will return null aft
217372

218373
Modify the status of an ongoing sandbox Request.
219374

375+
> These methods will throw `Stevenmaguire\Uber\Exception` when invoked while the client is not in sandbox mode. The underlying API endpoints have no effect unless you are using the sandbox environment.
376+
220377
```php
221378
$request = $client->requestRide(array(
222379
'product_id' => '4bfc6c57-98c0-424f-a72e-c1e2a1d49939',
@@ -226,16 +383,16 @@ $request = $client->requestRide(array(
226383
'end_longitude' => '-87.67126465'
227384
));
228385

229-
$updateRequest = $client->setRequest($request->request_id, ['status' => 'accepted']);
386+
$updateRequest = $client->setSandboxRequest($request->request_id, ['status' => 'accepted']);
230387
```
231388
[https://developer.uber.com/v1/sandbox/#request](https://developer.uber.com/v1/sandbox/#request)
232389

233390
Simulate the possible responses the Request endpoint will return when requesting a particular product, such as surge pricing, against the Sandbox.
234391

235392
```php
236-
$product = $client->getProduct($product_id);
393+
$product = $client->getProduct($productId);
237394

238-
$updateProduct = $client->setProduct($product_id, ['surge_multiplier' => 2.2, 'drivers_available' => false]);
395+
$updateProduct = $client->setSandboxProduct($productId, ['surge_multiplier' => 2.2, 'drivers_available' => false]);
239396
```
240397

241398
[https://developer.uber.com/v1/sandbox/#product-types](https://developer.uber.com/v1/sandbox/#product-types)

0 commit comments

Comments
 (0)