vimeo_ruby 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +66 -0
- data/README.md +17 -11
- data/lib/vimeo_ruby/base.rb +43 -0
- data/lib/vimeo_ruby/user/uploaded_video_collection.rb +13 -0
- data/lib/vimeo_ruby/user.rb +39 -0
- data/lib/vimeo_ruby/version.rb +1 -1
- data/lib/vimeo_ruby/video.rb +23 -0
- data/lib/vimeo_ruby.rb +5 -14
- data/vimeo_ruby.gemspec +40 -0
- metadata +43 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7000f9130237da5595d223c8a98598720a573a9be750378c37b6d1edb01080b2
|
4
|
+
data.tar.gz: dd9b26623d5bcf4bd80145f9acff65d00593cfdaa412c14f10629aa5f6fe87e2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 21d841070b073578b3c492c4c6f539a926ba9d7c5fc20b2f2784e1155b81a7903d78e0e542c3cd5d1940997b192ae2f9cdab27625a0fe01b32271bae6fbd0d4c
|
7
|
+
data.tar.gz: 2c9b3fb0a8ddaa5df8cc5df83b0658048209d50fea2cf1ca605213cdc2f4ca5bc32ea5b0ffe9e2bccf514150e2c1f8cd3dec68ad8b552469969f5929857c8ec7
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,9 @@
|
|
1
1
|
## [Unreleased]
|
2
2
|
|
3
|
+
## [0.2.0] - 2022-12-28
|
4
|
+
|
5
|
+
- Initial User and Video classes, with beginning interface to retrieve records from the Vimeo API. Adds a connection class used to hold a collection of a users uploaded videos (VimeoRuby::User::UploadedVideoCollection) accessible by calling `VimeoRuby::User#uploaded_videos`.
|
6
|
+
|
3
7
|
## [0.1.0] - 2022-12-25
|
4
8
|
|
5
9
|
- Initial release
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,66 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
vimeo_ruby (0.1.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
addressable (2.8.1)
|
10
|
+
public_suffix (>= 2.0.2, < 6.0)
|
11
|
+
ast (2.4.2)
|
12
|
+
crack (0.4.5)
|
13
|
+
rexml
|
14
|
+
hashdiff (1.0.1)
|
15
|
+
json (2.6.3)
|
16
|
+
language_server-protocol (3.17.0.2)
|
17
|
+
minitest (5.16.3)
|
18
|
+
parallel (1.22.1)
|
19
|
+
parser (3.1.3.0)
|
20
|
+
ast (~> 2.4.1)
|
21
|
+
public_suffix (5.0.1)
|
22
|
+
rainbow (3.1.1)
|
23
|
+
rake (13.0.6)
|
24
|
+
regexp_parser (2.6.1)
|
25
|
+
rexml (3.2.5)
|
26
|
+
rubocop (1.40.0)
|
27
|
+
json (~> 2.3)
|
28
|
+
parallel (~> 1.10)
|
29
|
+
parser (>= 3.1.2.1)
|
30
|
+
rainbow (>= 2.2.2, < 4.0)
|
31
|
+
regexp_parser (>= 1.8, < 3.0)
|
32
|
+
rexml (>= 3.2.5, < 4.0)
|
33
|
+
rubocop-ast (>= 1.23.0, < 2.0)
|
34
|
+
ruby-progressbar (~> 1.7)
|
35
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
36
|
+
rubocop-ast (1.24.0)
|
37
|
+
parser (>= 3.1.1.0)
|
38
|
+
rubocop-performance (1.15.1)
|
39
|
+
rubocop (>= 1.7.0, < 2.0)
|
40
|
+
rubocop-ast (>= 0.4.0)
|
41
|
+
ruby-progressbar (1.11.0)
|
42
|
+
standard (1.20.0)
|
43
|
+
language_server-protocol (~> 3.17.0.2)
|
44
|
+
rubocop (= 1.40.0)
|
45
|
+
rubocop-performance (= 1.15.1)
|
46
|
+
unicode-display_width (2.3.0)
|
47
|
+
vcr (6.1.0)
|
48
|
+
webmock (3.18.1)
|
49
|
+
addressable (>= 2.8.0)
|
50
|
+
crack (>= 0.3.2)
|
51
|
+
hashdiff (>= 0.4.0, < 2.0.0)
|
52
|
+
|
53
|
+
PLATFORMS
|
54
|
+
x86_64-darwin-21
|
55
|
+
x86_64-linux
|
56
|
+
|
57
|
+
DEPENDENCIES
|
58
|
+
minitest (~> 5.0)
|
59
|
+
rake (~> 13.0)
|
60
|
+
standard (~> 1.3)
|
61
|
+
vcr (~> 6.1)
|
62
|
+
vimeo_ruby!
|
63
|
+
webmock (~> 3.18, >= 3.18.1)
|
64
|
+
|
65
|
+
BUNDLED WITH
|
66
|
+
2.4.1
|
data/README.md
CHANGED
@@ -1,34 +1,40 @@
|
|
1
1
|
# VimeoRuby
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/vimeo_ruby`. To experiment with that code, run `bin/console` for an interactive prompt.
|
3
|
+
Welcome to VimeoRuby!
|
6
4
|
|
7
5
|
## Installation
|
8
6
|
|
9
|
-
TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
|
10
|
-
|
11
7
|
Install the gem and add to the application's Gemfile by executing:
|
12
8
|
|
13
|
-
$ bundle add
|
9
|
+
$ bundle add vimeo_ruby
|
14
10
|
|
15
11
|
If bundler is not being used to manage dependencies, install the gem by executing:
|
16
12
|
|
17
|
-
$ gem install
|
13
|
+
$ gem install vimeo_ruby
|
18
14
|
|
19
15
|
## Usage
|
20
16
|
|
21
|
-
|
17
|
+
WIP
|
22
18
|
|
23
19
|
## Development
|
24
20
|
|
21
|
+
At the moment, you will need to create a Vimeo account to obtain your own `access_token`, `client_identifier`, and `client_secret` if you wish to work on building out an interface to any of the Vimeo API endpoints.
|
22
|
+
Will be working on a solution to remedy this step in the future but for now, after obtaining these, set the values to the following env vars on your local machine accordingly:
|
23
|
+
- `VIMEO_ACCESS_TOKEN`
|
24
|
+
- `VIMEO_CLIENT_IDENTIFIER`
|
25
|
+
- `VIMEO_CLIENT_SECRET`
|
26
|
+
|
25
27
|
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
26
28
|
|
27
|
-
To install this gem onto your local machine, run `bundle exec rake install`.
|
29
|
+
To install this gem onto your local machine, run `bundle exec rake install`.
|
30
|
+
|
31
|
+
### Maintainers only
|
32
|
+
|
33
|
+
To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
28
34
|
|
29
35
|
## Contributing
|
30
36
|
|
31
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
37
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/cjilbert504/vimeo_ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/cjilbert504/vimeo_ruby/blob/main/CODE_OF_CONDUCT.md).
|
32
38
|
|
33
39
|
## License
|
34
40
|
|
@@ -36,4 +42,4 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
36
42
|
|
37
43
|
## Code of Conduct
|
38
44
|
|
39
|
-
Everyone interacting in the VimeoRuby project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/
|
45
|
+
Everyone interacting in the VimeoRuby project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/cjilbert504/vimeo_ruby/blob/main/CODE_OF_CONDUCT.md).
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require "json"
|
2
|
+
require "net/http"
|
3
|
+
|
4
|
+
module VimeoRuby
|
5
|
+
class Base
|
6
|
+
class << self
|
7
|
+
def base_uri
|
8
|
+
"https://api.vimeo.com"
|
9
|
+
end
|
10
|
+
|
11
|
+
def access_token
|
12
|
+
ENV["VIMEO_ACCESS_TOKEN"]
|
13
|
+
end
|
14
|
+
|
15
|
+
def client_identifier
|
16
|
+
ENV["VIMEO_CLIENT_IDENTIFIER"]
|
17
|
+
end
|
18
|
+
|
19
|
+
def client_secret
|
20
|
+
ENV["VIMEO_CLIENT_SECRET"]
|
21
|
+
end
|
22
|
+
|
23
|
+
def get(uri, query_params: {})
|
24
|
+
uri = URI.parse(uri)
|
25
|
+
uri.query = URI.encode_www_form(query_params)
|
26
|
+
|
27
|
+
Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |https|
|
28
|
+
request = Net::HTTP::Get.new(uri)
|
29
|
+
request.basic_auth(client_identifier, client_secret)
|
30
|
+
|
31
|
+
response = https.request(request)
|
32
|
+
JSON.parse(response.body)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
private
|
38
|
+
|
39
|
+
def extract_vimeo_id_from_uri(vimeo_uri)
|
40
|
+
vimeo_uri.match(/\d+/)[0].to_i
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module VimeoRuby
|
2
|
+
class User < VimeoRuby::Base
|
3
|
+
class UploadedVideoCollection
|
4
|
+
attr_reader :videos
|
5
|
+
|
6
|
+
def initialize(videos_array)
|
7
|
+
@videos = videos_array.map do |video_data|
|
8
|
+
VimeoRuby::Video.new(attrs: video_data)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module VimeoRuby
|
2
|
+
class User < VimeoRuby::Base
|
3
|
+
attr_reader :vimeo_id, :available_for_hire, :bio, :can_work_remotely, :location, :name, :profile_link, :additional_info
|
4
|
+
|
5
|
+
def initialize(attrs: {})
|
6
|
+
@vimeo_id = extract_vimeo_id_from_uri(attrs.delete("uri"))
|
7
|
+
@available_for_hire = attrs.delete("available_for_hire")
|
8
|
+
@bio = attrs.delete("bio")
|
9
|
+
@can_work_remotely = attrs.delete("can_work_remotely")
|
10
|
+
@location = attrs.delete("location")
|
11
|
+
@name = attrs.delete("name")
|
12
|
+
@profile_link = attrs.delete("link")
|
13
|
+
@additional_info = attrs
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.get_user(user_id)
|
17
|
+
user_info = get("#{base_uri}/users/#{user_id}")
|
18
|
+
new(attrs: user_info)
|
19
|
+
end
|
20
|
+
|
21
|
+
def base_uri
|
22
|
+
self.class.base_uri
|
23
|
+
end
|
24
|
+
|
25
|
+
def uploaded_videos(query_params: {})
|
26
|
+
uploaded_videos_response = self.class.get("#{base_uri}/users/#{vimeo_id}/videos", query_params: query_params)
|
27
|
+
uploaded_videos = uploaded_videos_response["data"]
|
28
|
+
VimeoRuby::User::UploadedVideoCollection.new(uploaded_videos)
|
29
|
+
end
|
30
|
+
|
31
|
+
def available_for_hire?
|
32
|
+
@available_for_hire
|
33
|
+
end
|
34
|
+
|
35
|
+
def can_work_remotely?
|
36
|
+
@can_work_remotely
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
data/lib/vimeo_ruby/version.rb
CHANGED
@@ -0,0 +1,23 @@
|
|
1
|
+
module VimeoRuby
|
2
|
+
class Video < VimeoRuby::Base
|
3
|
+
attr_reader :vimeo_id, :description, :duration, :embed_html, :link, :name, :player_embed_url, :type, :user, :additional_info
|
4
|
+
|
5
|
+
def initialize(attrs: {})
|
6
|
+
@vimeo_id = extract_vimeo_id_from_uri(attrs.delete("uri"))
|
7
|
+
@description = attrs.delete("description")
|
8
|
+
@duration = attrs.delete("duration")
|
9
|
+
@embed_html = attrs.delete("embed").delete("html")
|
10
|
+
@link = attrs.delete("link")
|
11
|
+
@name = attrs.delete("name")
|
12
|
+
@player_embed_url = attrs.delete("player_embed_url")
|
13
|
+
@type = attrs.delete("type")
|
14
|
+
@user = VimeoRuby::User.new(attrs: attrs.delete("user"))
|
15
|
+
@additional_info = attrs
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.get_video(video_id)
|
19
|
+
video_info = get("#{base_uri}/videos/#{video_id}")
|
20
|
+
new(attrs: video_info)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/vimeo_ruby.rb
CHANGED
@@ -1,20 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "
|
4
|
-
|
3
|
+
require "vimeo_ruby/base"
|
4
|
+
require "vimeo_ruby/user"
|
5
|
+
require "vimeo_ruby/user/uploaded_video_collection"
|
6
|
+
require "vimeo_ruby/version"
|
7
|
+
require "vimeo_ruby/video"
|
5
8
|
|
6
9
|
module VimeoRuby
|
7
10
|
class Error < StandardError; end
|
8
|
-
|
9
|
-
class Vimeo
|
10
|
-
attr_reader :base_uri
|
11
|
-
|
12
|
-
def initialize
|
13
|
-
@base_uri = URI("https://api.vimeo.com/tutorial")
|
14
|
-
end
|
15
|
-
|
16
|
-
def tutorial_request
|
17
|
-
Net::HTTP.get_response(base_uri, { "Authorization": "bearer #{ENV["VIMEO_ACCESS_TOKEN"]}" })
|
18
|
-
end
|
19
|
-
end
|
20
11
|
end
|
data/vimeo_ruby.gemspec
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative "lib/vimeo_ruby/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "vimeo_ruby"
|
7
|
+
spec.version = VimeoRuby::VERSION
|
8
|
+
spec.authors = ["Collin Jilbert"]
|
9
|
+
spec.email = ["cjilbert504@gmail.com"]
|
10
|
+
|
11
|
+
spec.summary = "A Ruby gem for interacting with the Vimeo API"
|
12
|
+
spec.description = "A Ruby gem for interacting with the Vimeo API"
|
13
|
+
spec.homepage = "https://github.com/cjilbert504/vimeo_ruby"
|
14
|
+
spec.license = "MIT"
|
15
|
+
spec.required_ruby_version = ">= 2.6.0"
|
16
|
+
|
17
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
18
|
+
spec.metadata["source_code_uri"] = "https://github.com/cjilbert504/vimeo_ruby"
|
19
|
+
spec.metadata["changelog_uri"] = "https://github.com/cjilbert504/vimeo_ruby/blob/main/CHANGELOG.md"
|
20
|
+
|
21
|
+
# Specify which files should be added to the gem when it is released.
|
22
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
23
|
+
spec.files = Dir.chdir(__dir__) do
|
24
|
+
`git ls-files -z`.split("\x0").reject do |f|
|
25
|
+
(f == __FILE__) || f.match(%r{\A(?:(?:bin|test|spec|features)/|\.(?:git|circleci)|appveyor)})
|
26
|
+
end
|
27
|
+
end
|
28
|
+
spec.bindir = "exe"
|
29
|
+
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
|
30
|
+
spec.require_paths = ["lib"]
|
31
|
+
|
32
|
+
# Uncomment to register a new dependency of your gem
|
33
|
+
# spec.add_dependency "example-gem", "~> 1.0"
|
34
|
+
|
35
|
+
spec.add_development_dependency "webmock", "~> 3.18", ">= 3.18.1"
|
36
|
+
spec.add_development_dependency "vcr", "~> 6.1"
|
37
|
+
|
38
|
+
# For more information and examples about making a new gem, check out our
|
39
|
+
# guide at: https://bundler.io/guides/creating_gem.html
|
40
|
+
end
|
metadata
CHANGED
@@ -1,15 +1,49 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vimeo_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Collin Jilbert
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-12-
|
12
|
-
dependencies:
|
11
|
+
date: 2022-12-28 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: webmock
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.18'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 3.18.1
|
23
|
+
type: :development
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '3.18'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 3.18.1
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: vcr
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '6.1'
|
40
|
+
type: :development
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '6.1'
|
13
47
|
description: A Ruby gem for interacting with the Vimeo API
|
14
48
|
email:
|
15
49
|
- cjilbert504@gmail.com
|
@@ -21,12 +55,18 @@ files:
|
|
21
55
|
- CHANGELOG.md
|
22
56
|
- CODE_OF_CONDUCT.md
|
23
57
|
- Gemfile
|
58
|
+
- Gemfile.lock
|
24
59
|
- LICENSE.txt
|
25
60
|
- README.md
|
26
61
|
- Rakefile
|
27
62
|
- lib/vimeo_ruby.rb
|
63
|
+
- lib/vimeo_ruby/base.rb
|
64
|
+
- lib/vimeo_ruby/user.rb
|
65
|
+
- lib/vimeo_ruby/user/uploaded_video_collection.rb
|
28
66
|
- lib/vimeo_ruby/version.rb
|
67
|
+
- lib/vimeo_ruby/video.rb
|
29
68
|
- sig/vimeo_ruby.rbs
|
69
|
+
- vimeo_ruby.gemspec
|
30
70
|
homepage: https://github.com/cjilbert504/vimeo_ruby
|
31
71
|
licenses:
|
32
72
|
- MIT
|