vimeo_api 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +29 -0
- data/Rakefile +1 -0
- data/lib/vimeo_api/client.rb +83 -0
- data/lib/vimeo_api/version.rb +3 -0
- data/lib/vimeo_api/video.rb +8 -0
- data/lib/vimeo_api.rb +10 -0
- data/vimeo_api.gemspec +26 -0
- metadata +124 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 636782b17ccbe130d3ff4166c0c35be6363296d1
|
4
|
+
data.tar.gz: 5ddf66ac3b20766b2821b707e404b68dd7559b07
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: a0ba439557e19e26945c7efc11c0a66de2344b921772a56dbf9761504037a993861820ebfb5975c800e37a4578261bd9cc7dd08b70ce681d2a098a2047860f76
|
7
|
+
data.tar.gz: afbf849cc8c7c8144bfe96af56aa0dd17569e834ade8f884574a4174287bcba78ca032350485fbb1dd1255cf911be0311ad7a9c4c24c901344053525783e28d1
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 danlewis
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# VimeoApi
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'vimeo_api'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install vimeo_api
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
TODO: Write usage instructions here
|
22
|
+
|
23
|
+
## Contributing
|
24
|
+
|
25
|
+
1. Fork it ( http://github.com/<my-github-username>/vimeo_api/fork )
|
26
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
27
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
28
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
29
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,83 @@
|
|
1
|
+
module VimeoApi
|
2
|
+
class Client
|
3
|
+
|
4
|
+
def initialize(options = {})
|
5
|
+
@consumer_key = options[:consumer_key]
|
6
|
+
@consumer_secret = options[:consumer_secret]
|
7
|
+
@token = options[:token]
|
8
|
+
@secret = options[:secret]
|
9
|
+
@debug = options[:debug]
|
10
|
+
@api_version = options[:api_version] || '3.2'
|
11
|
+
@api_host = options[:api_host] || 'api.vimeo.com'
|
12
|
+
@redirect_uri = options[:redirect_uri]
|
13
|
+
end
|
14
|
+
|
15
|
+
def authorize_url(options={})
|
16
|
+
consumer.auth_code.authorize_url(options)
|
17
|
+
end
|
18
|
+
|
19
|
+
def get_token(code)
|
20
|
+
consumer.auth_code.get_token(code, redirect_uri: @redirect_uri)
|
21
|
+
end
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
def auth_header
|
26
|
+
if @token.nil? || @token == ''
|
27
|
+
auth_header = Base64.strict_encode64("#{@consumer_key}:#{@consumer_secret}")
|
28
|
+
"basic #{auth_header}"
|
29
|
+
else
|
30
|
+
"Bearer #{@token}"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def consumer(options={})
|
35
|
+
@consumer ||= OAuth2::Client.new(
|
36
|
+
@consumer_key,
|
37
|
+
@consumer_secret,
|
38
|
+
{ site: "https://#{@api_host}",
|
39
|
+
token_url: "/oauth/access_token"
|
40
|
+
}
|
41
|
+
)
|
42
|
+
end
|
43
|
+
|
44
|
+
def access_token(options={})
|
45
|
+
@access_token ||= OAuth2::AccessToken.new(consumer, @token, options)
|
46
|
+
end
|
47
|
+
|
48
|
+
def get(path, headers={})
|
49
|
+
puts "[Client] GET #{path}" if @debug
|
50
|
+
headers.merge!(
|
51
|
+
"User-Agent" => "vimeo_api gem v#{VimeoApi::VERSION}",
|
52
|
+
"Accept" => "application/vnd.vimeo.*+json; version=#{@api_version}",
|
53
|
+
'Authorization' => auth_header
|
54
|
+
)
|
55
|
+
oauth_response = access_token.get("/#{path}", headers)
|
56
|
+
parse(oauth_response.body)
|
57
|
+
end
|
58
|
+
#
|
59
|
+
# def post(path, body='', headers={})
|
60
|
+
# puts "[Client] POST #{path}" if @debug
|
61
|
+
# headers.merge!("User-Agent" => "twitter_oauth gem v#{VimeoApi::VERSION}")
|
62
|
+
# headers.merge!("Content-Type" => "application/x-www-form-urlencoded\r\n")
|
63
|
+
# oauth_response = access_token.post("/#{@api_version}#{path}", body, headers)
|
64
|
+
# parse(oauth_response.body)
|
65
|
+
# end
|
66
|
+
#
|
67
|
+
# def delete(path, headers={})
|
68
|
+
# puts "[Client] DELETE #{path}" if @debug
|
69
|
+
# headers.merge!("User-Agent" => "twitter_oauth gem v#{TwitterOAuth::VERSION}")
|
70
|
+
# oauth_response = access_token.delete("/#{@api_version}#{path}", headers)
|
71
|
+
# parse(oauth_response.body)
|
72
|
+
# end
|
73
|
+
|
74
|
+
def parse(response_body)
|
75
|
+
begin
|
76
|
+
JSON.parse(response_body)
|
77
|
+
rescue JSON::ParserError
|
78
|
+
{:response => response_body}.to_json
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
end
|
83
|
+
end
|
data/lib/vimeo_api.rb
ADDED
data/vimeo_api.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'vimeo_api/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "vimeo_api"
|
8
|
+
spec.version = VimeoApi::VERSION
|
9
|
+
spec.authors = ["danlewis"]
|
10
|
+
spec.email = ["webmaster@adventistmedia.org.au"]
|
11
|
+
spec.summary = %q{Vimeo API version 3}
|
12
|
+
spec.description = %q{Vimeo API version 3}
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.5"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
spec.add_runtime_dependency(%q<oauth2>, [">= 1.0.0"])
|
24
|
+
spec.add_runtime_dependency(%q<json>, [">= 1.8.0"])
|
25
|
+
spec.add_runtime_dependency(%q<mime-types>, [">= 1.16"])
|
26
|
+
end
|
metadata
ADDED
@@ -0,0 +1,124 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: vimeo_api
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- danlewis
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-10-07 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.5'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.5'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: oauth2
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 1.0.0
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 1.0.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: json
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.8.0
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 1.8.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: mime-types
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.16'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.16'
|
83
|
+
description: Vimeo API version 3
|
84
|
+
email:
|
85
|
+
- webmaster@adventistmedia.org.au
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- ".gitignore"
|
91
|
+
- Gemfile
|
92
|
+
- LICENSE.txt
|
93
|
+
- README.md
|
94
|
+
- Rakefile
|
95
|
+
- lib/vimeo_api.rb
|
96
|
+
- lib/vimeo_api/client.rb
|
97
|
+
- lib/vimeo_api/version.rb
|
98
|
+
- lib/vimeo_api/video.rb
|
99
|
+
- vimeo_api.gemspec
|
100
|
+
homepage: ''
|
101
|
+
licenses:
|
102
|
+
- MIT
|
103
|
+
metadata: {}
|
104
|
+
post_install_message:
|
105
|
+
rdoc_options: []
|
106
|
+
require_paths:
|
107
|
+
- lib
|
108
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
109
|
+
requirements:
|
110
|
+
- - ">="
|
111
|
+
- !ruby/object:Gem::Version
|
112
|
+
version: '0'
|
113
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
requirements: []
|
119
|
+
rubyforge_project:
|
120
|
+
rubygems_version: 2.3.0
|
121
|
+
signing_key:
|
122
|
+
specification_version: 4
|
123
|
+
summary: Vimeo API version 3
|
124
|
+
test_files: []
|