Skip to content

Commit

Permalink
Merge pull request #17 from 3scale/add-client-header
Browse files Browse the repository at this point in the history
Add client header
  • Loading branch information
Vinay Bhalerao authored Feb 22, 2017
2 parents 5fc3638 + 4287c92 commit 5ecac17
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
7 changes: 5 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
# Change Log
All notable changes to this project will be documented in this file.

## Unreleased
## 2.7.1

### Added
- 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)

### Changed
- 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
- 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

##[2.7.0] - 2017-02-16
### Added
Expand Down
6 changes: 6 additions & 0 deletions lib/ThreeScaleClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

require_once(dirname(__FILE__) . '/ThreeScaleResponse.php');
require_once(dirname(__FILE__) . '/ThreeScaleAuthorizeResponse.php');
require_once(dirname(__FILE__) . '/version.php');


/**
Expand Down Expand Up @@ -557,7 +558,12 @@ private static function isHttpStatusCodeIn($httpResponse, $min, $max) {
public function setHttpClient($httpClient) {
if (is_null($httpClient)) {
$httpClient = new Curl;
$threeScaleVersion = new ThreeScaleVersion();

$version = $threeScaleVersion->getVersion();

$httpClient->options['CURLOPT_FOLLOWLOCATION'] = false;
$httpClient->headers['X-3scale-User-Agent'] = 'plugin-php-v'. $version;
}

$this->httpClient = $httpClient;
Expand Down
15 changes: 15 additions & 0 deletions lib/version.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?php

/*
** Defines ThreeScaleVersion class
*/

class ThreeScaleVersion {
private $version = '2.7.1';

public function getVersion() {
return $this->version;
}
}

?>

0 comments on commit 5ecac17

Please sign in to comment.