Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancements in the Latest Update #102

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
composer.lock
phpunit.xml
vendor
.phpunit.result.cache
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,20 @@ $vimeo->upload('/home/aaron/foo.mp4');

// Want to use a facade?
Vimeo::uploadImage('/videos/123/images', '/home/aaron/bar.png', true);
Vimeo::upload($video, [
'name' => NAME,
'privacy.view' => [
'anybody',
'contacts',
'disable',
'nobody',
'password',
'unlisted',
'users'
],
'folder_uri' => 'https://vimeo.com/manage/folders_name/folder_id'
]);
Vimeo::request('/videos/'. $value, ['per_page' => 2], 'GET');
```

[![Build Status](https://img.shields.io/travis/vimeo/laravel/master.svg?style=flat)](https://travis-ci.org/vimeo/laravel)
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"mockery/mockery": "^1.0",
"phpunit/phpunit": "^7.0|^9.5.10",
"psalm/plugin-laravel": "^1.4.0|^1.1|^2.7",
"laravel/lumen-framework": "^5.7",
"laravel/lumen-framework": "^5.8|^6.0|^7.0|^8.0|^9.0|^10.0",
"vimeo/psalm": "^3.17|^4.19|^5.6"
},
"autoload": {
Expand Down
44 changes: 23 additions & 21 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,28 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
beStrictAboutTestsThatDoNotTestAnything="true"
beStrictAboutOutputDuringTests="true"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
failOnRisky="true"
failOnWarning="true"
processIsolation="false"
stopOnError="false"
stopOnFailure="false"
verbose="true"
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
backupGlobals="false"
backupStaticAttributes="false"
beStrictAboutTestsThatDoNotTestAnything="true"
beStrictAboutOutputDuringTests="true"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
failOnRisky="true"
failOnWarning="true"
processIsolation="false"
stopOnError="false"
stopOnFailure="false"
verbose="true"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
>
<coverage processUncoveredFiles="true">
<include>
<directory suffix=".php">./src</directory>
</include>
</coverage>
<testsuites>
<testsuite name="Laravel Vimeo Test Suite">
<directory suffix="Test.php">./tests</directory>
<directory suffix="Test.php">./tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">./src</directory>
</whitelist>
</filter>
</phpunit>
36 changes: 36 additions & 0 deletions src/Rules/VideoIdRule.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php
namespace Vimeo\Laravel\Rules;

use Illuminate\Contracts\Validation\Rule;
use Vimeo\Laravel\Facades\Vimeo;

class VideoIdRule implements Rule
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is already separately in this PR https://github.com/vimeo/laravel/pull/92/files

{
/**
* Determine if the validation rule passes.
*
* @param string $attribute
* @param mixed $value
* @return bool
*/
public function passes($attribute, $value)
{
// Make an API request to Vimeo to check if the video with the given ID exists.
// Replace 'your-api-endpoint' with the actual API endpoint you want to use.
$response = Vimeo::request('/videos/'.$value, [], 'GET');

// Check if the response status is 200, indicating a successful request.
return data_get($response, 'status') === 200;
}

/**
* Get the validation error message.
*
* @return string
*/
public function message()
{
// Return a generic error message if the validation fails.
return __('The :attribute format is invalid.');
}
}
4 changes: 2 additions & 2 deletions src/VimeoManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,9 @@ public function __construct(Repository $config, VimeoFactory $factory)
*
* @param array $config
*
* @return \Vimeo\Vimeo
* @return object
*/
protected function createConnection(array $config): Vimeo
protected function createConnection(array $config): object
{
/** @var string[] $config */
return $this->factory->make($config);
Expand Down
2 changes: 1 addition & 1 deletion tests/AbstractTestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ abstract class AbstractTestCase extends AbstractPackageTestCase
*
* @return string
*/
protected function getServiceProviderClass($app)
protected function getServiceProviderClass()
{
return VimeoServiceProvider::class;
}
Expand Down