Skip to content

agilie/vimeo-api-gem

Repository files navigation

Vimeo API Client

Vimeo API Client

A Ruby wrapper for the Vimeo API. It utilizes v3 Vimeo API version. For more detailed documentation please refer to the Wiki and official Vimeo documentation

Installation

Add this line to your application's Gemfile:

gem 'vimeo_api_client', git: 'https://github.com/agilie/vimeo-api-gem'

And then execute:

$ bundle

Or install it yourself as:

$ gem install vimeo_api_client

Example

Usage

Universal API call

As long as not all the API endpoints are implemented in "Ruby Way" you can make any request with a universal wrapper i.e

Vimeo.resource.get('/api/resource/id/etc')

Available actions are get, post, put, patch and delete

For example

# Get all videos a user has liked
Vimeo.resource.get('/me/likes')

# Add video to an album
Vimeo.resource.put("/me/albums/#{album_id}/videos/#{video_id}")

# Delete a channel
Vimeo.resource.delete("/channels/#{channel_id}")

Working with resources

See more details on Wiki

Vimeo API workflow is based on a different resources such as users, videos, albums, comments etc. Each resource has its own uri and methods. Almost all of them has standard Create Read Update Destroy actions.

You can build a resource on the basis of its uri and call appropriate action:

# Get all albums of user with ID 12345
Vimeo.album('/users/12345/albums').index

# Delete my album with ID 67890
Vimeo.album('/me/albums/67890').destroy

Resource may have some specific actions, i.e.

# Add videos to my album
Vimeo.album('/me/albums/67890').add_videos(['11111', '22222', '33333'])

As you can see the resources are nested. For example, user can have many albums, video can have many comments and so on. Using this, you can rewrite actions above in more natural way:

# Get all albums of user with ID 12345
Vimeo.user('12345').albums.index

# Delete my album with ID 67890
Vimeo.user.album('67890').destroy

# Add videos to my album
Vimeo.user.album('67890').add_videos(['11111', '22222', '33333'])

Author

This gem is open-sourced by Agilie Team (info@agilie.com)

Contributor

Sergey Mell

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/agilie/vimeo-api-gem. This project is intended to be a safe, welcoming space for collaboration and contributors.

Contact us

If you have any questions, suggestions or just need a help with web or mobile development, please email us at web@agilie.com. You can ask us anything from basic to complex questions.

We will continue publishing new open-source projects. Stay with us, more updates will follow!

License

The gem is available as open source under the MIT License (MIT) Copyright © 2017 Agilie Team

Releases

No releases published

Packages

No packages published