Skip to content

Commit 5ecac17

Browse files
author
Vinay Bhalerao
authored
Merge pull request #17 from 3scale/add-client-header
Add client header
2 parents 5fc3638 + 4287c92 commit 5ecac17

3 files changed

Lines changed: 26 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
# Change Log
22
All notable changes to this project will be documented in this file.
33

4-
## Unreleased
4+
## 2.7.1
5+
6+
### Added
7+
- Added client header ```X-3scale-User-Agent: plugin-php-v{version-number} [PR #17](https://github.com/3scale/3scale_ws_api_for_php/pull/17)
58

69
### Changed
7-
- Allow custom host and port configurable for 3scale On premise SAAS platform [PR #16](https://github.com/3scale/3scale_ws_api_for_php/.) Note: For example, the signature is changed from ```$url = "http://" . $this->getHost() . "/transactions/authorize.xml"``` to ```$url = $this->getHost() . "/transactions/oauth_authorize.xml";``` for endpoints
10+
- Allow custom host and port configurable for 3scale On premise SAAS platform [PR #16](https://github.com/3scale/3scale_ws_api_for_php/pull/16) Note: For example, the signature is changed from ```$url = "http://" . $this->getHost() . "/transactions/authorize.xml"``` to ```$url = $this->getHost() . "/transactions/oauth_authorize.xml";``` for endpoints
811

912
##[2.7.0] - 2017-02-16
1013
### Added

lib/ThreeScaleClient.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
require_once(dirname(__FILE__) . '/ThreeScaleResponse.php');
1212
require_once(dirname(__FILE__) . '/ThreeScaleAuthorizeResponse.php');
13+
require_once(dirname(__FILE__) . '/version.php');
1314

1415

1516
/**
@@ -557,7 +558,12 @@ private static function isHttpStatusCodeIn($httpResponse, $min, $max) {
557558
public function setHttpClient($httpClient) {
558559
if (is_null($httpClient)) {
559560
$httpClient = new Curl;
561+
$threeScaleVersion = new ThreeScaleVersion();
562+
563+
$version = $threeScaleVersion->getVersion();
564+
560565
$httpClient->options['CURLOPT_FOLLOWLOCATION'] = false;
566+
$httpClient->headers['X-3scale-User-Agent'] = 'plugin-php-v'. $version;
561567
}
562568

563569
$this->httpClient = $httpClient;

lib/version.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
/*
4+
** Defines ThreeScaleVersion class
5+
*/
6+
7+
class ThreeScaleVersion {
8+
private $version = '2.7.1';
9+
10+
public function getVersion() {
11+
return $this->version;
12+
}
13+
}
14+
15+
?>

0 commit comments

Comments
 (0)