Skip to content

Commit 6527e82

Browse files
authored
Merge pull request #11 from 3scale/serviceIdUpdate
Service id update
2 parents a7913dd + de6970a commit 6527e82

2 files changed

Lines changed: 11 additions & 10 deletions

File tree

README.markdown

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,16 @@ Then, create an instance of the client, giving it your provider API key:
1818

1919
Because the object is stateless, you can create just one and store it globally.
2020

21+
**NOTE: From November 2016 `service_id` is mandatory.**
22+
2123
### Authorize
2224

2325
To authorize a particular application, call the `authorize` method passing it the
2426
application id and optionally the application key:
2527

2628
$response = $client->authorize("the app id", "the app key");
29+
or
30+
$response = $client->authorize("the app id", "the app key", "the service id");
2731

2832
Then call the `isSuccess()` method on the returned object to see if the authorization was
2933
successful:
@@ -34,14 +38,12 @@ successful:
3438
// Something's wrong with this app.
3539
}
3640

37-
If both provider and app id are valid, the response object contains additional information
38-
about the status of the application:
41+
If both provider and app id are valid, the response object contains additional information about the status of the application:
3942

4043
// Returns the name of the plan the application is signed up to.
4144
$response->getPlan()
4245

43-
If the plan has defined usage limits, the response contains details about the usage broken
44-
down by the metrics and usage limit periods.
46+
If the plan has defined usage limits, the response contains details about the usage broken down by the metrics and usage limit periods.
4547

4648
// The usageReports array contains one element per each usage limit defined on the plan.
4749
$usageReports = $response->getUsageReports();
@@ -64,8 +66,7 @@ down by the metrics and usage limit periods.
6466
// If the limit is exceeded, this will be true, otherwise false:
6567
$usageReport->isExceeded() // false
6668

67-
If the authorization failed, the `getErrorCode()` returns system error code and
68-
`getErrorMessage()` human readable error description:
69+
If the authorization failed, the `getErrorCode()` returns system error code and `getErrorMessage()` human readable error description:
6970

7071
$response->getErrorCode() // "usage_limits_exceeded"
7172
$response->getErrorMessage() // "Usage limits are exceeded"
@@ -76,7 +77,7 @@ To report usage, use the `report` method. You can report multiple transaction at
7677

7778
$response = $client->report(array(
7879
array('app_id' => "first app's id", 'usage' => array('hits' => 1)),
79-
array('app_id' => "second app's id", 'usage' => array('hits' => 1))));
80+
array('app_id' => "second app's id", 'usage' => array('hits' => 1))), "service id");
8081

8182
The `"app_id"` and `"usage"` parameters are required. Additionaly, you can specify a timestamp
8283
of the transaction:

lib/ThreeScaleClient.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public function getHost() {
6666
*
6767
* @param $appId application id.
6868
* @param $appKey secret application key.
69-
* @param $serviceId service id, only required in the case of multiple services
69+
* @param $serviceId service id required (from November 2016)
7070
*
7171
* @return ThreeScaleResponse object containing additional authorization information.
7272
* If both provider key and application id are valid, the returned object is actually
@@ -123,7 +123,7 @@ public function authorize($appId, $appKey = null, $serviceId = null, $usage = nu
123123
*
124124
* @param $appId application id or client id (they are equivalent)
125125
* @param $usage usage
126-
* @param $serviceId service id, only required in the case of multiple services
126+
* @param $serviceId service id, required (from November 2016)
127127
*
128128
* @return ThreeScaleResponse object containing additional authorization information.
129129
* If both provider key and application id are valid, the returned object is actually
@@ -175,7 +175,7 @@ public function oauth_authorize($appId, $serviceId = null, $usage = null) {
175175
* Authorize an application.
176176
*
177177
* @param $userKey user key.
178-
* @param $serviceId service id, only required in the case of multiple services
178+
* @param $serviceId service id, required (from November 2016)
179179
*
180180
* @return ThreeScaleResponse object containing additional authorization information.
181181
* If both provider key and application id are valid, the returned object is actually

0 commit comments

Comments
 (0)