Skip to content

Commit

Permalink
create new TusHelper class (#240)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sventour authored and nbeliard committed Dec 12, 2019
1 parent a446e36 commit 316cdb0
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# Changelog
## [3.0.5] - 2019-12-11
### Fixed
- Fixes `setUrl` method not found error.([#239](https://github.com/vimeo/vimeo.php/pull/239))
- Adds `TusHelper` class.

## [3.0.4] - 2019-12-02
### Fixed
- Fixes "invalid bucket" error when uploading a new video. ([#237](https://github.com/vimeo/vimeo.php/pull/237))
Expand Down Expand Up @@ -112,6 +117,7 @@
### Added
- This is the Vimeo library for version 3 of the Vimeo API.

[3.0.5]: https://github.com/vimeo/vimeo.php/compare/3.0.4...3.0.5
[3.0.4]: https://github.com/vimeo/vimeo.php/compare/3.0.3...3.0.4
[3.0.3]: https://github.com/vimeo/vimeo.php/compare/3.0.2...3.0.3
[3.0.2]: https://github.com/vimeo/vimeo.php/compare/3.0.1...3.0.2
Expand Down
20 changes: 20 additions & 0 deletions src/Vimeo/Upload/TusClient.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php


namespace Vimeo\Upload;



class TusClient extends \TusPhp\Tus\Client
{
/**
* Sets the url for retrieving the TUS upload.
* @param string $url
* @return $this
*/
public function setUrl(string $url)
{
$this->url = $url;
return $this;
}
}
5 changes: 3 additions & 2 deletions src/Vimeo/Vimeo.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Vimeo\Exceptions\VimeoException;
use Vimeo\Exceptions\VimeoRequestException;
use Vimeo\Exceptions\VimeoUploadException;
use Vimeo\Upload\TusClient;

/**
* Copyright 2013 Vimeo
Expand Down Expand Up @@ -34,7 +35,7 @@ class Vimeo
const CLIENT_CREDENTIALS_TOKEN_ENDPOINT = '/oauth/authorize/client';
const VERSIONS_ENDPOINT = '/versions';
const VERSION_STRING = 'application/vnd.vimeo.*+json; version=3.4';
const USER_AGENT = 'vimeo.php 3.0.4; (http://developer.vimeo.com/api/docs)';
const USER_AGENT = 'vimeo.php 3.0.5; (http://developer.vimeo.com/api/docs)';
const CERTIFICATE_PATH = '/certificates/vimeo-api.pem';

/** @var array */
Expand Down Expand Up @@ -590,7 +591,7 @@ private function perform_upload_tus(string $file_path, $file_size, array $attemp
$failures = 0;
$chunk_size = $this->getTusUploadChunkSize($default_chunk_size, (int)$file_size);

$client = new \TusPhp\Tus\Client($base_url);
$client = new TusClient($base_url);
$client->setApiPath($api_path);
$client->setKey($key)->file($file_path);
$client->setUrl($url);
Expand Down

0 comments on commit 316cdb0

Please sign in to comment.