acts_as_kaltura 1.1.0 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +36 -1
- data/lib/acts_as_kaltura/category.rb +11 -4
- data/lib/acts_as_kaltura/version.rb +1 -1
- metadata +10 -10
data/README.md
CHANGED
@@ -53,7 +53,6 @@ It will sync your `Annotation` model with kaltura cuepoint annotation object.
|
|
53
53
|
class Annotation < ActiveRecord::Base
|
54
54
|
belongs_to :video
|
55
55
|
acts_as_kaltura_annotation
|
56
|
-
|
57
56
|
def as_annotation_cuepoint
|
58
57
|
ActsAsKaltura::Extension::KalturaAnnotation.new.tap do |cp|
|
59
58
|
cp.cue_point_type = ActsAsKaltura::Extension::KalturaAnnotation::TYPE_ANNOTATION
|
@@ -69,6 +68,7 @@ class Annotation < ActiveRecord::Base
|
|
69
68
|
end
|
70
69
|
end
|
71
70
|
```
|
71
|
+
|
72
72
|
### Annotation model must includes the following fields -
|
73
73
|
|
74
74
|
> * cuepoint_key (String)
|
@@ -77,10 +77,45 @@ end
|
|
77
77
|
|
78
78
|
Sync local categories with Kaltura. You have to set existing kaltura category id to any of your parent categories. When you create sub category (you must have `parent` method exposed) it will automatically pushed to kaltura. Same goes for updating and deleting kaltura category. (if you destroy child category it will automatically remove kaltura category)
|
79
79
|
|
80
|
+
### Usages -
|
81
|
+
|
82
|
+
```ruby
|
83
|
+
class Category < ActiveRecord::Base
|
84
|
+
belongs_to :parent, :class_name => 'Category'
|
85
|
+
has_many :categories, :foreign_key => 'parent_id'
|
86
|
+
has_and_belongs_to_many :videos
|
87
|
+
|
88
|
+
acts_as_kaltura_category
|
89
|
+
|
90
|
+
def as_kaltura_category
|
91
|
+
Kaltura::Category.new.tap do |c|
|
92
|
+
c.name = self.name
|
93
|
+
if kaltura_reference_found?
|
94
|
+
c.parent_id = self.parent.kaltura_category_key
|
95
|
+
end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
end
|
99
|
+
```
|
100
|
+
|
101
|
+
|
80
102
|
### Required fields
|
103
|
+
|
81
104
|
> * kaltura_category_key (String)
|
82
105
|
|
83
106
|
## How to install
|
107
|
+
|
84
108
|
> gem install acts_as_kaltura
|
85
109
|
|
110
|
+
## Configuration
|
111
|
+
|
112
|
+
Create file under `RAILS_ROOT/config/kaltura.yml`.
|
113
|
+
[Checkout the sample](kaltura.yml.sample)
|
114
|
+
|
115
|
+
## Changes
|
116
|
+
|
117
|
+
* Added kaltura_parent_categories class method
|
118
|
+
|
119
|
+
* Made kaltura_reference_found? method public
|
120
|
+
|
86
121
|
|
@@ -10,6 +10,14 @@ module ActsAsKaltura
|
|
10
10
|
before_update :update_kaltura_category
|
11
11
|
before_destroy :destroy_kaltura_category
|
12
12
|
end
|
13
|
+
|
14
|
+
#
|
15
|
+
# Retrieve all categories from kaltura which has no parent id
|
16
|
+
def kaltura_parent_categories
|
17
|
+
filter = Kaltura::Filter::CategoryFilter.new
|
18
|
+
filter.parent_id_equal = 0
|
19
|
+
self.kaltura_client.category_service.list(filter)
|
20
|
+
end
|
13
21
|
end
|
14
22
|
|
15
23
|
def kaltura_category
|
@@ -33,10 +41,9 @@ module ActsAsKaltura
|
|
33
41
|
self.class.kaltura_client.category_service.list(filter)
|
34
42
|
end
|
35
43
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
end
|
44
|
+
def kaltura_reference_found?
|
45
|
+
self.parent && self.parent.kaltura_category_key.present?
|
46
|
+
end
|
40
47
|
|
41
48
|
private
|
42
49
|
def create_kaltura_category
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acts_as_kaltura
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-02-
|
12
|
+
date: 2012-02-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: jeweler
|
16
|
-
requirement: &
|
16
|
+
requirement: &2157371520 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *2157371520
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: velir_kaltura-ruby
|
27
|
-
requirement: &
|
27
|
+
requirement: &2157370220 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *2157370220
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: activesupport
|
38
|
-
requirement: &
|
38
|
+
requirement: &2157368520 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: 3.1.3
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *2157368520
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: activerecord
|
49
|
-
requirement: &
|
49
|
+
requirement: &2157382180 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,7 +54,7 @@ dependencies:
|
|
54
54
|
version: 3.1.3
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *2157382180
|
58
58
|
description: Acts as kaltura
|
59
59
|
email: hasan@somewherein.net
|
60
60
|
executables: []
|