kaltura_fu 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -23,7 +23,7 @@ Install the gem with the command:
23
23
  gem install kaltura_fu
24
24
  Run:
25
25
 
26
- script/generate kaltura_fu_install
26
+ rails g kaltura_fu:install
27
27
 
28
28
  This will install the kaltura.yml file into your application's config directory and the kaltura_upload.js into the application's public/javascripts directory.
29
29
 
data/Rakefile CHANGED
@@ -54,15 +54,9 @@ task :default => :test
54
54
 
55
55
  require 'rake/rdoctask'
56
56
  Rake::RDocTask.new do |rdoc|
57
- if File.exist?('VERSION.yml')
58
- config = YAML.load(File.read('VERSION.yml'))
59
- version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
60
- else
61
- version = ""
62
- end
63
57
 
64
58
  rdoc.rdoc_dir = 'rdoc'
65
- rdoc.title = "kaltura-ruby #{version}"
59
+ rdoc.title = "kaltura-ruby"
66
60
  rdoc.rdoc_files.include('README*')
67
61
  rdoc.rdoc_files.include('lib/**/*.rb')
68
62
  end
@@ -2,14 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
4
4
  # -*- encoding: utf-8 -*-
5
+ $:.push File.expand_path("../lib", __FILE__)
6
+ require 'kaltura_fu/version'
5
7
 
6
8
  Gem::Specification.new do |s|
7
9
  s.name = %q{kaltura_fu}
8
- s.version = "0.2.0"
10
+ s.version = KalturaFu::Version.dup
9
11
 
10
12
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
13
  s.authors = ["Patrick Robertson"]
12
- s.date = %q{2010-11-06}
14
+ s.date = %q{2011-04-20}
13
15
  s.email = %q{patrick.robertson@velir.com}
14
16
  s.extra_rdoc_files = [
15
17
  "README.markdown"
@@ -20,11 +22,11 @@ Gem::Specification.new do |s|
20
22
  "README.markdown",
21
23
  "Rakefile",
22
24
  "VERSION.yml",
23
- "generators/kaltura_fu_install/kaltura_fu_install_generator.rb",
24
- "generators/kaltura_fu_install/templates/kaltura.yml",
25
- "generators/kaltura_fu_install/templates/kaltura_upload.js",
26
25
  "install.rb",
27
26
  "kaltura_fu.gemspec",
27
+ "lib/generators/kaltura_fu/install_generator.rb",
28
+ "lib/generators/templates/kaltura.yml",
29
+ "lib/generators/templates/kaltura_upload.js",
28
30
  "lib/kaltura_fu.rb",
29
31
  "lib/kaltura_fu/configuration.rb",
30
32
  "lib/kaltura_fu/entry.rb",
@@ -35,6 +37,7 @@ Gem::Specification.new do |s|
35
37
  "lib/kaltura_fu/entry/metadata/class_and_instance_methods.rb",
36
38
  "lib/kaltura_fu/entry/metadata/class_methods.rb",
37
39
  "lib/kaltura_fu/railtie.rb",
40
+ "lib/kaltura_fu/version.rb",
38
41
  "lib/kaltura_fu/view_helpers.rb",
39
42
  "rails/init.rb",
40
43
  "spec/debug.log",
@@ -0,0 +1,16 @@
1
+ module KalturaFu
2
+ module Generators
3
+ class InstallGenerator < Rails::Generators::Base
4
+ source_root File.expand_path("../../templates",__FILE__)
5
+ desc "Copies the Kaltura config file and upload JS to your app."
6
+
7
+ def copy_config
8
+ copy_file "kaltura.yml", "config/kaltura.yml"
9
+ end
10
+
11
+ def copy_javascript
12
+ copy_file "kaltura_upload.js", "public/javascripts/kaltura_upload.js"
13
+ end
14
+ end
15
+ end
16
+ end
@@ -5,13 +5,12 @@ module KalturaFu
5
5
  # Class level methods for the Entry module.
6
6
  ##
7
7
  module ClassMethods
8
- #extend KalturaFu::Entry::Metadata
9
8
  ##
10
9
  # Allows you to upload some variety of media into Kaltura.
11
10
  # This isn't going to be as great to use as one of their flash widgets, and
12
11
  # should likely be used "off" the web process to not slow the application down.
13
12
  #
14
- # @param upload_object The object to upload. Currently, it only works with a File.
13
+ # @param [File] upload_object The object to upload. Currently, it only works with a File.
15
14
  # @param [Hash] options An options hash of Kaltura Media Entry attributes to add & the
16
15
  # upload_object source.
17
16
  # @option options [Symbol] :source(nil) Currently only accepts :file
@@ -93,6 +93,21 @@ module KalturaFu
93
93
 
94
94
  end
95
95
 
96
+ ##
97
+ # Sets multiple Kaltura::MediaEntry attributes in one convienant method.
98
+ #
99
+ # @param [String] entry_id The Kaltura entry ID.
100
+ # @param [Hash] attributes
101
+ # @option attributes [String] :attribute A Kaltura::MediaEntry attribute to set
102
+ ##
103
+ def set(entry_id, attributes={})
104
+ KalturaFu.check_for_client_session
105
+
106
+ attributes.each do |key,value|
107
+ attribute = key.to_s
108
+ set_attribute(attribute,entry_id,value) if valid_entry_attribute?(key)
109
+ end
110
+ end
96
111
  ##
97
112
  # @private
98
113
  ##
@@ -9,20 +9,20 @@ module KalturaFu
9
9
 
10
10
  ActionView::Base.send :include, KalturaFu::ViewHelpers
11
11
 
12
- kaltura_yml = File.join(RAILS_ROOT,'config','kaltura.yml')
12
+ kaltura_yml = File.join(Rails.root,'config','kaltura.yml')
13
13
 
14
- unless File.exists?(kaltura_yml)
15
- raise RuntimeError, "Unable to find \"config/kaltura.yml\" file."
16
- end
17
-
18
- config_file = YAML.load_file(kaltura_yml)[Rails.env]
19
- KalturaFu.config = config_file.symbolize_keys
20
-
21
-
22
- unless[:partner_id,:subpartner_id,:administrator_secret].all? {|key| KalturaFu.config.key?(key)}
23
- raise RuntimeError, "Kaltura config requires :partner_id, :subpartner_id,"+
24
- "and :administrator_secret keys"
14
+ if File.exists?(kaltura_yml)
15
+ config_file = YAML.load_file(kaltura_yml)[Rails.env]
16
+ KalturaFu.config = config_file.symbolize_keys
17
+
18
+ unless[:partner_id,:subpartner_id,:administrator_secret].all? {|key| KalturaFu.config.key?(key)}
19
+ warn "Kaltura config requires :partner_id, :subpartner_id, and :administrator_secret keys"
20
+ end
21
+ else
22
+ #raise RuntimeError, "Unable to find \"config/kaltura.yml\" file."
23
+ warn "Unable to find \"config/kaltura.yml\" file. Please run kaltura_fu:install generator."
25
24
  end
25
+
26
26
  end
27
27
  end
28
28
  end
@@ -0,0 +1,3 @@
1
+ module KalturaFu
2
+ Version = '0.2.1'
3
+ end
@@ -54,7 +54,7 @@ module KalturaFu
54
54
  seconds_parameter = "/vid_sec/5"
55
55
  end
56
56
 
57
- image_tag("http://www.kaltura.com/p/#{KalturaFu.config[:partner_id]}" +
57
+ image_tag("#{KalturaFu.cofing[:service_url]}/p/#{KalturaFu.config[:partner_id]}" +
58
58
  "/thumbnail/entry_id/#{entry_id}" +
59
59
  seconds_parameter +
60
60
  size_parameters)
@@ -119,7 +119,7 @@ module KalturaFu
119
119
  name: \"#{options[:div_id]}\"
120
120
  };
121
121
 
122
- swfobject.embedSWF(\"http://www.kaltura.com/kwidget/wid/_#{KalturaFu.config[:partner_id]}" + player_conf_parameter + "\",\"#{options[:div_id]}\",\"#{width}\",\"#{height}\",\"10.0.0\",\"http://ttv.mit.edu/swfs/expressinstall.swf\",flashVars,params,attributes);
122
+ swfobject.embedSWF(\"#{KalturaFu.config[:service_url]}/kwidget/wid/_#{KalturaFu.config[:partner_id]}" + player_conf_parameter + "\",\"#{options[:div_id]}\",\"#{width}\",\"#{height}\",\"10.0.0\",\"http://ttv.mit.edu/swfs/expressinstall.swf\",flashVars,params,attributes);
123
123
  </script>"
124
124
  end
125
125
 
@@ -155,7 +155,7 @@ module KalturaFu
155
155
  maxTotalSize: \"999999999\"
156
156
  };
157
157
 
158
- swfobject.embedSWF(\"http://www.kaltura.com/kupload/ui_conf_id/1103\", \"uploader\", \"160\", \"26\", \"9.0.0\", \"expressInstall.swf\", flashVars, params,attributes);
158
+ swfobject.embedSWF(\"#{KalturaFu.config[:service_url]}/kupload/ui_conf_id/1103\", \"uploader\", \"160\", \"26\", \"9.0.0\", \"expressInstall.swf\", flashVars, params,attributes);
159
159
 
160
160
  </script>"
161
161
  end
@@ -268,4 +268,16 @@ describe "Actions on an entries metadata" do
268
268
  end
269
269
  end
270
270
  end
271
+
272
+ it "should let you set multiple fields at once with set()" do
273
+ test = MetadataSpecTester.new
274
+
275
+ name = "Mr Peanut's wild ride"
276
+ description = "Man this is a random name"
277
+ waffles = "Man waffles isn't an attribute"
278
+ test.set(@entry_id,:name=>name,:description=>description,:waffles=>waffles)
279
+
280
+ test.get_name(@entry_id).should == name
281
+ test.get_description(@entry_id).should == description
282
+ end
271
283
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kaltura_fu
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 0
10
- version: 0.2.0
9
+ - 1
10
+ version: 0.2.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Patrick Robertson
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-11-06 00:00:00 -04:00
18
+ date: 2011-04-20 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -78,11 +78,11 @@ files:
78
78
  - README.markdown
79
79
  - Rakefile
80
80
  - VERSION.yml
81
- - generators/kaltura_fu_install/kaltura_fu_install_generator.rb
82
- - generators/kaltura_fu_install/templates/kaltura.yml
83
- - generators/kaltura_fu_install/templates/kaltura_upload.js
84
81
  - install.rb
85
82
  - kaltura_fu.gemspec
83
+ - lib/generators/kaltura_fu/install_generator.rb
84
+ - lib/generators/templates/kaltura.yml
85
+ - lib/generators/templates/kaltura_upload.js
86
86
  - lib/kaltura_fu.rb
87
87
  - lib/kaltura_fu/configuration.rb
88
88
  - lib/kaltura_fu/entry.rb
@@ -93,6 +93,7 @@ files:
93
93
  - lib/kaltura_fu/entry/metadata/class_and_instance_methods.rb
94
94
  - lib/kaltura_fu/entry/metadata/class_methods.rb
95
95
  - lib/kaltura_fu/railtie.rb
96
+ - lib/kaltura_fu/version.rb
96
97
  - lib/kaltura_fu/view_helpers.rb
97
98
  - rails/init.rb
98
99
  - spec/debug.log
@@ -1,11 +0,0 @@
1
- class KalturaFuInstallGenerator < Rails::Generator::Base
2
- def manifest
3
- record do |m|
4
- m.directory "config"
5
- m.file "kaltura.yml", "config/kaltura.yml"
6
-
7
- m.directory "public/javascripts"
8
- m.file "kaltura_upload.js" , "public/javascripts/kaltura_upload.js"
9
- end
10
- end
11
- end