kaltura_box 0.0.2 → 0.0.3
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 +4 -4
- data/README.md +7 -2
- data/Rakefile +1 -0
- data/kaltura_box.gemspec +13 -12
- data/lib/kaltura_box.rb +7 -6
- data/lib/kaltura_box/api.rb +0 -1
- data/lib/kaltura_box/client.rb +1 -1
- data/lib/kaltura_box/entry/class_methods.rb +22 -4
- data/lib/kaltura_box/entry/instance_methods.rb +14 -0
- data/lib/kaltura_box/railtie.rb +14 -0
- data/lib/kaltura_box/version.rb +1 -1
- data/lib/kaltura_box/view_helpers.rb +1 -1
- data/spec/entry_spec.rb +7 -2
- data/spec/spec_helper.rb +1 -0
- metadata +25 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f375c77fe96869ad197c45e9df1cc2ff1aa8ce36
|
4
|
+
data.tar.gz: f7013fc8f9eeb106cf61ab6ed2d2862b0f15a41a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32022352ffd0713f4f92ee0a46e43427292ea22b308819674431633b7290e0f05b65a63077c2b4f2ec91e3ce1312e82a262a9c136fcc7ebe2fe2238b009b8d32
|
7
|
+
data.tar.gz: 1891c0064cdce0243137d288b2a44e11275cd6eb7ec20db3e5deb0b844d711042081bb8b79c8ca1593620aec087f733223087920da9f580bc9c748ee0368eb5c
|
data/README.md
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
# KalturaBox
|
2
2
|
|
3
|
-
|
3
|
+
[](https://travis-ci.org/shinnyx/kaltura_box)
|
4
|
+
[](http://badge.fury.io/rb/kaltura_box)
|
5
|
+
|
6
|
+
Customized Ruby wrapper for Kaltura API on Active Record
|
7
|
+
|
8
|
+
**THIS GEM IS NOT BEING MAINTAINED ANYMORE**
|
4
9
|
|
5
10
|
Heavily influenced and continuation of [Kaltura_Fu](https://github.com/Velir/kaltura_fu)
|
6
11
|
|
@@ -58,7 +63,7 @@ video.set_description = "blablabla"
|
|
58
63
|
|
59
64
|
## Contributing
|
60
65
|
|
61
|
-
1. Fork it ( https://github.com/
|
66
|
+
1. Fork it ( https://github.com/shinnyx/kaltura_box/fork )
|
62
67
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
63
68
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
64
69
|
4. Push to the branch (`git push origin my-new-feature`)
|
data/Rakefile
CHANGED
data/kaltura_box.gemspec
CHANGED
@@ -4,25 +4,26 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
require 'kaltura_box/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
7
|
+
spec.name = 'kaltura_box'
|
8
8
|
spec.version = KalturaBox::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
11
|
-
spec.summary =
|
9
|
+
spec.authors = ['Shinn Chong']
|
10
|
+
spec.email = ['shinnyx@gmail.com']
|
11
|
+
spec.summary = 'Ruby wrapper for Kaltura API on Active Record'
|
12
12
|
spec.description = spec.summary
|
13
|
-
spec.homepage =
|
14
|
-
spec.license =
|
13
|
+
spec.homepage = 'https://github.com/shinnyx/kaltura_box'
|
14
|
+
spec.license = 'MIT'
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0")
|
17
17
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
-
spec.require_paths = [
|
19
|
+
spec.require_paths = ['lib']
|
20
20
|
|
21
|
-
spec.
|
21
|
+
spec.add_dependency('kaltura-ruby-client')
|
22
22
|
|
23
|
-
spec.add_development_dependency
|
24
|
-
spec.add_development_dependency
|
25
|
-
spec.add_development_dependency 'rspec'
|
26
|
-
spec.add_development_dependency 'activerecord'
|
23
|
+
spec.add_development_dependency 'bundler', '~> 1.6'
|
24
|
+
spec.add_development_dependency 'rake'
|
25
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
26
|
+
spec.add_development_dependency 'activerecord', '~> 4.0'
|
27
27
|
spec.add_development_dependency 'sqlite3'
|
28
|
+
spec.add_development_dependency 'pry'
|
28
29
|
end
|
data/lib/kaltura_box.rb
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
require 'kaltura'
|
2
|
-
require
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
2
|
+
require 'kaltura_box/api'
|
3
|
+
require 'kaltura_box/category'
|
4
|
+
require 'kaltura_box/client'
|
5
|
+
require 'kaltura_box/entry'
|
6
|
+
require 'kaltura_box/version'
|
7
7
|
|
8
8
|
module KalturaBox
|
9
|
-
require '
|
9
|
+
require 'kaltura_box/railtie' if defined?(Rails) &&
|
10
|
+
Rails.version.split('.').first > '2'
|
10
11
|
end
|
data/lib/kaltura_box/api.rb
CHANGED
data/lib/kaltura_box/client.rb
CHANGED
@@ -29,7 +29,7 @@ module KalturaBox
|
|
29
29
|
|
30
30
|
raise "Missing Administrator Secret" unless KalturaBox.config.administrator_secret
|
31
31
|
begin
|
32
|
-
@session_key = @client.session_service.start(KalturaBox.config.administrator_secret, '', Kaltura::KalturaSessionType::ADMIN)
|
32
|
+
@session_key = @client.session_service.start(KalturaBox.config.administrator_secret, '', Kaltura::KalturaSessionType::ADMIN, KalturaBox.config.partner_id, 315360000)
|
33
33
|
rescue Kaltura::KalturaAPIError => e
|
34
34
|
puts e.message
|
35
35
|
end
|
@@ -22,6 +22,22 @@ module KalturaBox
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
+
def add_thumbnail(entry_id, value, type=nil)
|
26
|
+
client = KalturaBox::Client.update_session
|
27
|
+
media_service = Kaltura::KalturaMediaService.new(client)
|
28
|
+
media = nil
|
29
|
+
|
30
|
+
case type
|
31
|
+
when :jpg
|
32
|
+
media = media_service.update_thumbnail_jpeg(entry_id, value)
|
33
|
+
when :url
|
34
|
+
media = media_service.update_thumbnail_from_url(entry_id, value)
|
35
|
+
else
|
36
|
+
media = media_service.update_thumbnail(entry_id, value)
|
37
|
+
end
|
38
|
+
media.thumbnail_url
|
39
|
+
end
|
40
|
+
|
25
41
|
def video_list(keyword = nil)
|
26
42
|
client = KalturaBox::Client.update_session
|
27
43
|
media = Kaltura::KalturaMediaService.new(client)
|
@@ -34,14 +50,14 @@ module KalturaBox
|
|
34
50
|
media_list = media.list
|
35
51
|
end
|
36
52
|
|
37
|
-
return nil unless media_list.objects
|
53
|
+
return nil unless media_list.present? && media_list.objects
|
38
54
|
|
39
55
|
media_list.objects.reject { |v| v.media_type != 1 }
|
40
56
|
end
|
41
57
|
|
42
|
-
def update_all_videos!
|
58
|
+
def update_all_videos!(options={})
|
43
59
|
video_list.each do |v|
|
44
|
-
self.
|
60
|
+
entry = self.new(
|
45
61
|
entry_id: v.id,
|
46
62
|
title: v.name,
|
47
63
|
description: v.description,
|
@@ -49,10 +65,12 @@ module KalturaBox
|
|
49
65
|
data_url: v.data_url,
|
50
66
|
download_url: v.download_url,
|
51
67
|
ms_duration: v.ms_duration,
|
52
|
-
tags: v.tags,
|
53
68
|
plays: v.plays,
|
54
69
|
views: v.views
|
55
70
|
)
|
71
|
+
options.each { |key, value| entry.send("#{key}=", value) }
|
72
|
+
entry.tag_list = v.tags if entry.try(:tag_list)
|
73
|
+
entry.save
|
56
74
|
end
|
57
75
|
end
|
58
76
|
|
@@ -8,6 +8,20 @@ module KalturaBox
|
|
8
8
|
media.get(self.entry_id)
|
9
9
|
end
|
10
10
|
|
11
|
+
def update_thumbnail(type=nil, value)
|
12
|
+
self.add_thumbnail(self.entry_id, value, type)
|
13
|
+
end
|
14
|
+
|
15
|
+
def fetch_thumbnail
|
16
|
+
kaltura_video = self.get
|
17
|
+
unless kaltura_video.empty?
|
18
|
+
self.thumbnail_url = kaltura_video.thumbnail_url
|
19
|
+
self.save
|
20
|
+
else
|
21
|
+
false
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
11
25
|
end
|
12
26
|
end
|
13
27
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'kaltura_box'
|
2
|
+
require 'kaltura_box/view_helpers'
|
3
|
+
require 'rails'
|
4
|
+
|
5
|
+
module KalturaBox
|
6
|
+
class Railtie < Rails::Railtie
|
7
|
+
initializer 'install kaltura_box' do
|
8
|
+
$: << File.dirname(__FILE__) + '/../lib'
|
9
|
+
|
10
|
+
ActionView::Base.send :include, KalturaBox::ViewHelpers
|
11
|
+
require "kaltura"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/lib/kaltura_box/version.rb
CHANGED
@@ -16,7 +16,7 @@ module KalturaBox
|
|
16
16
|
##
|
17
17
|
# Convienence to include SWFObject and the required Kaltura upload embed javascripts.
|
18
18
|
##
|
19
|
-
def
|
19
|
+
def include_kaltura_box(*args)
|
20
20
|
content = javascript_include_tag('kaltura_upload')
|
21
21
|
content << javascript_include_tag('//ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js')
|
22
22
|
end
|
data/spec/entry_spec.rb
CHANGED
@@ -35,8 +35,13 @@ describe "KalturaBox::Entry" do
|
|
35
35
|
end
|
36
36
|
|
37
37
|
context "update all videos" do
|
38
|
-
before(:each)
|
39
|
-
|
38
|
+
before(:each) do
|
39
|
+
KalturaBoxTest.setup_db!
|
40
|
+
Video.update_all_videos!(company_id: 5)
|
41
|
+
end
|
42
|
+
|
43
|
+
it { expect(Video.count).to eq videos.count }
|
44
|
+
it { expect(Video.last.company_id).to eq 5 }
|
40
45
|
end
|
41
46
|
|
42
47
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kaltura_box
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shinn Chong
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-12-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: kaltura-ruby-client
|
@@ -56,18 +56,32 @@ dependencies:
|
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0'
|
61
|
+
version: '3.0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '0'
|
68
|
+
version: '3.0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: activerecord
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '4.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '4.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: sqlite3
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
72
86
|
requirements:
|
73
87
|
- - ">="
|
@@ -81,7 +95,7 @@ dependencies:
|
|
81
95
|
- !ruby/object:Gem::Version
|
82
96
|
version: '0'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
98
|
+
name: pry
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
86
100
|
requirements:
|
87
101
|
- - ">="
|
@@ -94,7 +108,7 @@ dependencies:
|
|
94
108
|
- - ">="
|
95
109
|
- !ruby/object:Gem::Version
|
96
110
|
version: '0'
|
97
|
-
description: Ruby wrapper for Kaltura API
|
111
|
+
description: Ruby wrapper for Kaltura API on Active Record
|
98
112
|
email:
|
99
113
|
- shinnyx@gmail.com
|
100
114
|
executables: []
|
@@ -123,6 +137,7 @@ files:
|
|
123
137
|
- lib/kaltura_box/entry/metadata.rb
|
124
138
|
- lib/kaltura_box/entry/metadata/class_and_instance_methods.rb
|
125
139
|
- lib/kaltura_box/entry/metadata/class_methods.rb
|
140
|
+
- lib/kaltura_box/railtie.rb
|
126
141
|
- lib/kaltura_box/version.rb
|
127
142
|
- lib/kaltura_box/view_helpers.rb
|
128
143
|
- spec/api_spec.rb
|
@@ -208,10 +223,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
208
223
|
version: '0'
|
209
224
|
requirements: []
|
210
225
|
rubyforge_project:
|
211
|
-
rubygems_version: 2.
|
226
|
+
rubygems_version: 2.4.5.1
|
212
227
|
signing_key:
|
213
228
|
specification_version: 4
|
214
|
-
summary: Ruby wrapper for Kaltura API
|
229
|
+
summary: Ruby wrapper for Kaltura API on Active Record
|
215
230
|
test_files:
|
216
231
|
- spec/api_spec.rb
|
217
232
|
- spec/category_spec.rb
|