Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
69 changed files
with
7,064 additions
and
4,252 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# Path-based git attributes | ||
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html | ||
|
||
# Ignore all test and documentation with "export-ignore". | ||
/.gitattributes export-ignore | ||
/.gitignore export-ignore | ||
/.travis.yml export-ignore | ||
/phpunit.xml.dist export-ignore | ||
/.scrutinizer.yml export-ignore | ||
/tests export-ignore |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
|
||
build | ||
composer.lock | ||
docs | ||
vendor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,22 @@ | ||
# How to contribute | ||
# Contributing | ||
|
||
We want to keep it as easy as possible to contribute changes that | ||
get things working in your environment. There are a few guidelines that we | ||
need contributors to follow so that we can have a chance of keeping on | ||
top of things. | ||
Contributions are **welcome** and will be fully **credited**. | ||
|
||
## Getting Started | ||
We accept contributions via Pull Requests on [Github](https://github.com/ticketevolution/ticketevolution-php). | ||
|
||
* Make sure you have a [GitHub account](https://github.com/signup/free) | ||
* [Submit an Issue](https://github.com/ticketevolution/ticketevolution-php/issues), assuming one does not already exist. | ||
* Clearly describe the issue including steps to reproduce when it is a bug. | ||
* Make sure you fill in the earliest version that you know has the issue. | ||
* Fork the repository on GitHub | ||
|
||
## Making Changes | ||
## Pull Requests | ||
|
||
* Create a topic branch from where you want to base your work. | ||
* This is usually the master branch. | ||
* Only target release branches if you are certain your fix must be on that | ||
branch. | ||
* To quickly create a topic branch based on master; `git branch | ||
fix/master/my_contribution master` then checkout the new branch with `git | ||
checkout fix/master/my_contribution`. Please avoid working directly on the | ||
`master` branch. | ||
* Make commits of logical units. | ||
* Check for unnecessary whitespace with `git diff --check` before committing. | ||
* Make sure your commit messages are in the proper format. | ||
- **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)** - The easiest way to apply the conventions is to install [PHP Code Sniffer](http://pear.php.net/package/PHP_CodeSniffer). | ||
|
||
```` | ||
The first line is a real life imperative statement with a ticket number | ||
from the issue tracker. The body describes the behavior without the patch, | ||
why this is a problem, and how the patch fixes the problem when applied. | ||
```` | ||
- **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date. | ||
|
||
## Submitting Changes | ||
- **Consider our release cycle** - We try to follow [SemVer v2.0.0](http://semver.org/). Randomly breaking public APIs is not an option. | ||
|
||
* Push your changes to a topic branch in your fork of the repository. | ||
* Submit a pull request to the repository in the TeamOneTickets organization. | ||
* Update your Issue to mark that you have submitted code and are ready for it to be reviewed. | ||
* Include a link to the pull request in the ticket | ||
- **Create feature branches** - Don't ask us to pull from your master branch. | ||
|
||
# Syntax | ||
* Four spaces, no tabs. | ||
* No trailing whitespace. Blank lines should not have any space. | ||
* Prefer &&/|| over and/or. | ||
* a = b and not a=b. | ||
* Follow the conventions you see used in the source already. | ||
- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests. | ||
|
||
- **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please squash them before submitting. | ||
|
||
# Additional Resources | ||
|
||
* [General GitHub documentation](http://help.github.com/) | ||
* [GitHub pull request documentation](http://help.github.com/send-pull-requests/) | ||
|
||
|
||
|
||
*With thanks/apologies to [Puppet Labs](https://github.com/puppetlabs/puppet/blob/master/CONTRIBUTING.md)* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,209 @@ | ||
# PHP Client Library v3 for the [Ticket Evolution API](http://developer.ticketevolution.com/) | ||
|
||
## Basic Usage | ||
```php | ||
<?php | ||
|
||
// Require Composer’s autoloader | ||
require 'vendor/autoload.php'; | ||
|
||
// Create an API Client | ||
$apiClient = TicketEvolution::settings([ | ||
'baseUrl' => 'https://api.sandbox.ticketevolution.com', | ||
'apiVersion' => 'v9', | ||
'apiToken' => 'xxxxxxxxxxxxxxxxxxxxxxxx', | ||
'apiSecret' => 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy', | ||
]); | ||
|
||
// Get a list of the 25 most popular events sorted by descending popularity | ||
try { | ||
$events = $apiClient->listEvents([ | ||
'page' => 1, | ||
'per_page' => 25, | ||
'order_by' => 'events.popularity_score DESC', | ||
]); | ||
} catch (\Exception $e) { | ||
// Handle your Exceptions | ||
} | ||
``` | ||
|
||
## Advanced Usage | ||
Here is a much more “real world” setup that also includes a logger ([Monolog](https://github.com/Seldaek/monolog) in this example), a [retry subscriber](https://github.com/guzzle/retry-subscriber/) and the included `RequestTimer` subscriber. | ||
|
||
In your Terminal: | ||
``` | ||
$ php composer require ticketevolution/ticketevolution-php monolog/monolog guzzlehttp/retry-subscriber | ||
``` | ||
|
||
```php | ||
<?php | ||
|
||
use GuzzleHttp\Subscriber\Log\Formatter; | ||
use GuzzleHttp\Subscriber\Log\LogSubscriber; | ||
use GuzzleHttp\Subscriber\Retry\RetrySubscriber; | ||
use Monolog\Handler\StreamHandler; | ||
use Monolog\Logger; | ||
use TicketEvolution\Client as TEvoClient; | ||
use TicketEvolution\Subscriber\RequestTimer; | ||
|
||
// Require Composer’s autoloader | ||
require 'vendor/autoload.php'; | ||
|
||
/** | ||
* Setup Logger | ||
* This creates a file logger with a level of Debug mode for development. | ||
* For Production you probably want to adjust the log level. | ||
*/ | ||
$log = new Logger('TEvoAPIClientLogger'); | ||
$log->pushHandler(new StreamHandler('/Users/jcobb/Sites/www.myaweometicketsite.dev/myaweometicketsite.com/app/storage/logs/guzzle.log', Logger::DEBUG)); | ||
$logSubscriber = new LogSubscriber($log, Formatter::DEBUG); | ||
|
||
/** | ||
* Setup Retry Subscriber | ||
* This creates a retry subscriber that automatically retries requests that errored on connection (such as a timeout) | ||
*/ | ||
$retrySubscriber = new RetrySubscriber([ | ||
'filter' => RetrySubscriber::createConnectFilter() | ||
]); | ||
|
||
/** | ||
* Setup Request Timer Subscriber | ||
* This project includes a RequestTimer subscriber which allows you to see how long it took to send a request and receive the results. | ||
* You probably want to turn this off in Production | ||
*/ | ||
$requestTimer = new RequestTimer(); | ||
|
||
// Create an API Client | ||
$apiClient = TicketEvolution::settings([ | ||
'baseUrl' => 'https://api.sandbox.ticketevolution.com', | ||
'apiVersion' => 'v9', | ||
'apiToken' => 'xxxxxxxxxxxxxxxxxxxxxxxx', | ||
'apiSecret' => 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy', | ||
]); | ||
|
||
// Attach the log subscriber | ||
$client->getEmitter()->attach($logSubscriber); | ||
// Attach the retry subscriber | ||
$client->getEmitter()->attach($retrySubscriber); | ||
// Attach the RequestTimer subscriber | ||
$client->getEmitter()->attach($requestTimer); | ||
|
||
// Get a list of the 25 most popular events sorted by descending popularity | ||
try { | ||
$events = $apiClient->listEvents([ | ||
'page' => 1, | ||
'per_page' => 25, | ||
'order_by' => 'events.popularity_score DESC', | ||
]); | ||
} catch (\Exception $e) { | ||
// Handle your Exceptions | ||
} | ||
|
||
// Use the RequestTimer to see how long the operation took. | ||
echo 'Request took ' . $requestTimer->getElapsedTime() . ' seconds'; | ||
``` | ||
|
||
## Even More Advanced Usage | ||
If you have a need to use some of Guzzle’s more advanced features such as [Pools for batching of requests](http://guzzle.readthedocs.org/en/latest/clients.html?highlight=batch#batching-requests) you can do that. You will need to specify explicit URLs as [Pools](http://guzzle.readthedocs.org/en/latest/clients.html?highlight=batch#sending-requests-with-a-pool) cannot be used with the provided Service Definition which provides the handy magic methods such as `listEvents()`. | ||
|
||
```php | ||
<?php | ||
|
||
use GuzzleHttp\Subscriber\Log\Formatter; | ||
use GuzzleHttp\Subscriber\Log\LogSubscriber; | ||
use GuzzleHttp\Subscriber\Retry\RetrySubscriber; | ||
use Monolog\Handler\StreamHandler; | ||
use Monolog\Logger; | ||
use TicketEvolution\Client as TEvoClient; | ||
use TicketEvolution\Subscriber\RequestTimer; | ||
use GuzzleHttp\Client as GuzzleClient; | ||
use GuzzleHttp\Pool; | ||
use TicketEvolution\Subscriber\RequestTimer; | ||
use TicketEvolution\Subscriber\TEvoAuth; | ||
|
||
// Require Composer’s autoloader | ||
require 'vendor/autoload.php'; | ||
|
||
/** | ||
* Setup Logger | ||
* This creates a file logger with a level of Debug mode for development. | ||
* For Production you probably want to adjust the log level. | ||
*/ | ||
$log = new Logger('TEvoAPIClientLogger'); | ||
$log->pushHandler(new StreamHandler('/Users/jcobb/Sites/www.myaweometicketsite.dev/myaweometicketsite.com/app/storage/logs/guzzle.log', Logger::DEBUG)); | ||
$logSubscriber = new LogSubscriber($log, Formatter::DEBUG); | ||
|
||
/** | ||
* Setup Retry Subscriber | ||
* This creates a retry subscriber that automatically retries requests that errored on connection (such as a timeout) | ||
*/ | ||
$retrySubscriber = new RetrySubscriber([ | ||
'filter' => RetrySubscriber::createConnectFilter() | ||
]); | ||
|
||
/** | ||
* Setup Request Timer Subscriber | ||
* This project includes a RequestTimer subscriber which allows you to see how long it took to send a request and receive the results. | ||
* You probably want to turn this off in Production | ||
*/ | ||
$requestTimer = new RequestTimer(); | ||
|
||
// Create an API client that can handle Pools | ||
$poolClient = new GuzzleClient([ | ||
'base_url' => [ | ||
'https://api.sandbox.ticketevolution.com', | ||
['apiVersion' => 'v9'], | ||
], | ||
'defaults' => [ | ||
'auth' => 'tevoauth', | ||
] | ||
]); | ||
|
||
|
||
/** | ||
* Attach various subscribers | ||
*/ | ||
// Attach the TEvoAuth subscriber to handle [request signing](https://ticketevolution.atlassian.net/wiki/display/API/Signing) | ||
$poolClient->getEmitter()->attach(new TEvoAuth('xxxxxxxxxxxxxxxxxxxxxxxx', 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy')); | ||
|
||
// Attach the log subscriber | ||
$poolClient->getEmitter()->attach($logSubscriber); | ||
|
||
// Attach the retry subscriber | ||
$poolClient->getEmitter()->attach($retrySubscriber); | ||
|
||
|
||
|
||
/** | ||
* Create the requests to be pooled. | ||
* Since you must specify the actual URLs be sure to [follow the documentation and sort your GET parameters](https://ticketevolution.atlassian.net/wiki/display/API/Signing#Signing-GETrequests). | ||
*/ | ||
$requests = [ | ||
// Get a list of the 5 most popular SPORTS events anywhere sorted by descending popularity | ||
$poolClient->createRequest('GET', 'events?category_id=1&category_tree=true&order_by=events.popularity_score+DESC&page=1&per_page=5'), | ||
|
||
// Get a list of the 5 most popular CONCERTS events anywhere sorted by descending popularity | ||
$poolClient->createRequest('GET', 'events?category_id=54&category_tree=true&order_by=events.popularity_score+DESC&page=1&per_page=5'), | ||
|
||
// Get a list of the 5 most popular THEATRE events anywhere sorted by descending popularity | ||
$poolClient->createRequest('GET', 'events?category_id=68&category_tree=true&order_by=events.popularity_score+DESC&page=1&per_page=5'), | ||
]; | ||
|
||
// $results is a GuzzleHttp\BatchResults object. | ||
try { | ||
$results = Pool::batch($poolClient, $requests); | ||
} catch (\Exception $e) { | ||
// Handle your Exceptions | ||
} | ||
|
||
// Can be accessed by index. | ||
$i = 0; | ||
foreach ($requests as $request) { | ||
echo '<p>' . $results[$i]->getBody() . '</p>' . PHP_EOL; | ||
$i++; | ||
} | ||
|
||
// Use the RequestTimer to see how long the operation took. | ||
echo 'Requests took ' . $requestTimer->getElapsedTime() . ' seconds'; | ||
|
||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# The BSD 3-Clause License | ||
|
||
Copyright (c) 2015, Ticket Evolution, Inc. | ||
|
||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without modification, | ||
are permitted provided that the following conditions are met: | ||
|
||
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. | ||
|
||
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. | ||
|
||
* Neither the name of Ticket Evolution, Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.