vimeoapi 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 00ede416eb29e215d7767700f7d45633219ca9e5
4
- data.tar.gz: f5657ccb10ec97424b755e51cd150ae14445bc84
3
+ metadata.gz: e5de4dfb68a32e146dc88b85bc07fe8d8cb5e717
4
+ data.tar.gz: 4bd4467fb2c2e972aa6c81d15766db77f91bfa75
5
5
  SHA512:
6
- metadata.gz: b2b05931f9ecaa044403ba878599fbd9c7d7a69f2372178a18395789950805148af5a4f681bd320fe487ed45d244f243141d9e5663f0763df0b8988b7fa20a86
7
- data.tar.gz: 6ecf292f4e880bacb504cb8aa6a6ffa9f6025bc8f2acb1667dac05c777966b8f8dd6486b73291e3875949bcdd954f34aad19a02a9f30dfdf67d1aa05d60eeb00
6
+ metadata.gz: 80f0b326919f6b10041fcfaccc45aecbbd5bb108f031a46a99d465bde7aff7d1244e8818fb90c56d47d8546e8c21d7f47ee1993b2abe3058ce80011b6e943414
7
+ data.tar.gz: 404bf28160d7c727d6e8f481060ab4e728e7ea4c556079335c5224e6656dcea13fe14512d390d17ff05be33099d9853c252e854d4c8569e81e88ba22cb3fbc8f
data/Gemfile CHANGED
@@ -16,3 +16,4 @@ group :development do
16
16
  end
17
17
 
18
18
  gem "httparty", "~> 0.13.7"
19
+ gem "streamio-ffmpeg", "~> 1.0.0"
data/Gemfile.lock CHANGED
@@ -70,6 +70,7 @@ GEM
70
70
  json (~> 1.8)
71
71
  simplecov-html (~> 0.10.0)
72
72
  simplecov-html (0.10.0)
73
+ streamio-ffmpeg (1.0.0)
73
74
  test-unit (3.1.5)
74
75
  power_assert
75
76
  thread_safe (0.3.5)
@@ -87,6 +88,7 @@ DEPENDENCIES
87
88
  rdoc (~> 3.12)
88
89
  shoulda
89
90
  simplecov
91
+ streamio-ffmpeg (~> 1.0.0)
90
92
  test-unit
91
93
 
92
94
  BUNDLED WITH
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.1
1
+ 0.1.2
data/lib/vimeo.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require "vimeo/base"
2
2
  require "vimeo/utils"
3
+ require "vimeo/exceptions"
3
4
 
4
5
  module Vimeo
5
6
 
@@ -8,5 +9,5 @@ module Vimeo
8
9
  post('/me/videos', options)
9
10
  end
10
11
  end
11
-
12
+
12
13
  end
@@ -0,0 +1,4 @@
1
+ module Vimeo
2
+ class FileNotFound < Exception
3
+ end
4
+ end
data/lib/vimeo/utils.rb CHANGED
@@ -1,17 +1,11 @@
1
+ require 'streamio-ffmpeg'
2
+
1
3
  module Vimeo
2
4
  class Utils
3
5
 
4
6
  def self.insert_logo(file_path, logo_path, new_file_path = nil)
5
-
6
- unless File.exist?(file_path)
7
- exception_msg = "Cannot add logo to video because path does not exist: #{file_path}"
8
- raise Exception, exception_msg
9
- end
10
-
11
- unless File.exist?(logo_path)
12
- exception_msg = "Cannot add logo to video because path does not exist: #{logo_path}"
13
- raise Exception, exception_msg
14
- end
7
+ check_file_exists(file_path, :video)
8
+ check_file_exists(logo_path, :logo_image)
15
9
 
16
10
  new_file_path ||= file_with_logo_path(file_path)
17
11
  File.remove(new_file_path) if File.exist?(new_file_path)
@@ -20,8 +14,20 @@ module Vimeo
20
14
  new_file_path
21
15
  end
22
16
 
17
+ def self.duration(file)
18
+ check_file_exists(file, :video)
19
+ movie = FFMPEG::Movie.new(file)
20
+ movie.duration
21
+ end
22
+
23
23
  private
24
24
 
25
+ def self.check_file_exists(file_path, type)
26
+ unless File.exist?(file_path)
27
+ raise FileNotFound, "#{type.to_s.capitalize} file does not exist: #{file_path}"
28
+ end
29
+ end
30
+
25
31
  def self.file_with_logo_path(path)
26
32
  if path =~ /(\.\w{3,4})$/
27
33
  path.gsub(/(\.\w{3,4})$/, "withlogo#{$1}")
@@ -1,2 +1,2 @@
1
1
  access_token:
2
- INSERTYOURACCESSTOKENHERE
2
+ dd3614d006acf59f8c6ecd1f69c23046
data/test/test_basic.rb CHANGED
@@ -39,4 +39,7 @@ class TestVimeo < Test::Unit::TestCase
39
39
  File.delete(@new_video_path)
40
40
  end
41
41
 
42
+ should "check size of video" do
43
+ assert_equal 10.03, Vimeo::Utils.duration(@old_video_path)
44
+ end
42
45
  end
data/vimeoapi.gemspec CHANGED
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: vimeoapi 0.1.1 ruby lib
5
+ # stub: vimeoapi 0.1.2 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "vimeoapi"
9
- s.version = "0.1.1"
9
+ s.version = "0.1.2"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["\u{201c}Paulo"]
14
- s.date = "2015-11-13"
14
+ s.date = "2015-11-19"
15
15
  s.description = "Ruby wrapper to Vimeo REST Api with some video utilities"
16
16
  s.email = "\u{201c}phsoares.ita@gmail.com\u{201d}"
17
17
  s.extra_rdoc_files = [
@@ -28,6 +28,7 @@ Gem::Specification.new do |s|
28
28
  "VERSION",
29
29
  "lib/vimeo.rb",
30
30
  "lib/vimeo/base.rb",
31
+ "lib/vimeo/exceptions.rb",
31
32
  "lib/vimeo/utils.rb",
32
33
  "test/config/secrets.yml",
33
34
  "test/files/logo.png",
@@ -47,6 +48,7 @@ Gem::Specification.new do |s|
47
48
 
48
49
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
49
50
  s.add_runtime_dependency(%q<httparty>, ["~> 0.13.7"])
51
+ s.add_runtime_dependency(%q<streamio-ffmpeg>, ["~> 1.0.0"])
50
52
  s.add_development_dependency(%q<shoulda>, [">= 0"])
51
53
  s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
52
54
  s.add_development_dependency(%q<bundler>, ["~> 1.0"])
@@ -56,6 +58,7 @@ Gem::Specification.new do |s|
56
58
  s.add_development_dependency(%q<byebug>, [">= 0"])
57
59
  else
58
60
  s.add_dependency(%q<httparty>, ["~> 0.13.7"])
61
+ s.add_dependency(%q<streamio-ffmpeg>, ["~> 1.0.0"])
59
62
  s.add_dependency(%q<shoulda>, [">= 0"])
60
63
  s.add_dependency(%q<rdoc>, ["~> 3.12"])
61
64
  s.add_dependency(%q<bundler>, ["~> 1.0"])
@@ -66,6 +69,7 @@ Gem::Specification.new do |s|
66
69
  end
67
70
  else
68
71
  s.add_dependency(%q<httparty>, ["~> 0.13.7"])
72
+ s.add_dependency(%q<streamio-ffmpeg>, ["~> 1.0.0"])
69
73
  s.add_dependency(%q<shoulda>, [">= 0"])
70
74
  s.add_dependency(%q<rdoc>, ["~> 3.12"])
71
75
  s.add_dependency(%q<bundler>, ["~> 1.0"])
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vimeoapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - "“Paulo"
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-11-13 00:00:00.000000000 Z
11
+ date: 2015-11-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 0.13.7
27
+ - !ruby/object:Gem::Dependency
28
+ name: streamio-ffmpeg
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: 1.0.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: 1.0.0
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: shoulda
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -139,6 +153,7 @@ files:
139
153
  - VERSION
140
154
  - lib/vimeo.rb
141
155
  - lib/vimeo/base.rb
156
+ - lib/vimeo/exceptions.rb
142
157
  - lib/vimeo/utils.rb
143
158
  - test/config/secrets.yml
144
159
  - test/files/logo.png