kaltura 0.0.1 → 0.1.0

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.
@@ -0,0 +1,55 @@
1
+ ---
2
+ - !ruby/struct:VCR::HTTPInteraction
3
+ request: !ruby/struct:VCR::Request
4
+ method: :get
5
+ uri: http://www.kaltura.com:80/api_v3/?action=start&ks=&partnerId=1&secret=superdupersecret&service=session&type=2
6
+ body:
7
+ headers:
8
+ response: !ruby/struct:VCR::Response
9
+ status: !ruby/struct:VCR::ResponseStatus
10
+ code: 200
11
+ message: OK
12
+ headers:
13
+ date:
14
+ - Fri, 26 Aug 2011 21:38:40 GMT
15
+ server:
16
+ - Apache
17
+ vary:
18
+ - Accept-Encoding
19
+ x-me:
20
+ - pa-apache3
21
+ x-ua-compatible:
22
+ - IE=EmulateIE7
23
+ content-length:
24
+ - "230"
25
+ content-type:
26
+ - text/xml
27
+ body: <?xml version="1.0" encoding="utf-8"?><xml><result>thisisavalidsession</result><executionTime>0.048589944839478</executionTime></xml>
28
+ http_version: "1.1"
29
+ - !ruby/struct:VCR::HTTPInteraction
30
+ request: !ruby/struct:VCR::Request
31
+ method: :get
32
+ uri: http://www.kaltura.com:80/api_v3/?action=start&ks=&partnerId=2&secret=superdupersecret&service=session&type=2
33
+ body:
34
+ headers:
35
+ response: !ruby/struct:VCR::Response
36
+ status: !ruby/struct:VCR::ResponseStatus
37
+ code: 200
38
+ message: OK
39
+ headers:
40
+ date:
41
+ - Fri, 26 Aug 2011 21:38:40 GMT
42
+ server:
43
+ - Apache
44
+ vary:
45
+ - Accept-Encoding
46
+ x-me:
47
+ - pa-apache3
48
+ x-ua-compatible:
49
+ - IE=EmulateIE7
50
+ content-length:
51
+ - "227"
52
+ content-type:
53
+ - text/xml
54
+ body: <?xml version="1.0" encoding="utf-8"?><xml><result><error><code>START_SESSION_ERROR</code><message>Error while starting session for partner [2]</message></error></result><executionTime>0.040677070617676</executionTime></xml>
55
+ http_version: "1.1"
@@ -0,0 +1,19 @@
1
+ require 'spec_helper'
2
+
3
+ describe Kaltura::Configuration do
4
+ context "as a DSL" do
5
+ describe "should properly set and read config values" do
6
+ before do
7
+ Kaltura.configure do |config|
8
+ config.partner_id = 15
9
+ config.administrator_secret = 'asdf'
10
+ config.service_url = 'http://waffles.com'
11
+ end
12
+ end
13
+
14
+ it { Kaltura.config.partner_id.should == 15 }
15
+ it { Kaltura.config.administrator_secret.should == 'asdf' }
16
+ it { Kaltura.config.service_url.should == 'http://waffles.com' }
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,102 @@
1
+ require 'spec_helper'
2
+
3
+ describe Kaltura::MediaEntry do
4
+ use_vcr_cassette
5
+
6
+ before do
7
+ Kaltura.configure do |config|
8
+ config.partner_id = 1
9
+ config.administrator_secret = 'superdupersecret'
10
+ config.service_url = 'http://www.kaltura.com'
11
+ end
12
+ end
13
+
14
+ context "retrieving an entry" do
15
+ describe "should be able to retrieve an existing video." do
16
+ before do
17
+ @entry = Kaltura::MediaEntry.get('0_2vk9wpn9')
18
+ end
19
+
20
+ it { @entry.should be_an_instance_of Kaltura::MediaEntry }
21
+ it { @entry.id.should eql('0_2vk9wpn9') }
22
+ end
23
+
24
+ describe "should raise an error retrieving a non-existant video." do
25
+ it { lambda { Kaltura::MediaEntry.get('waffleman') }.should raise_error Kaltura::KalturaError }
26
+ end
27
+ end
28
+
29
+ context "retrieving multiple entries" do
30
+ describe "should be able to retrieve all videos." do
31
+ it { lambda { Kaltura::MediaEntry.list }.should_not raise_error }
32
+ end
33
+
34
+ describe "retrieving without paramters." do
35
+ before do
36
+ @entries_list = Kaltura::MediaEntry.list
37
+ end
38
+
39
+ it { @entries_list.should be_an_instance_of Array }
40
+ it { @entries_list.first.should be_an_instance_of Kaltura::MediaEntry }
41
+ it { @entries_list.should have_at_least(1).things }
42
+ it { @entries_list.should have_at_most(30).things }
43
+ end
44
+
45
+ context "retrieve another page." do
46
+ describe "should be able to retrieve another page." do
47
+ before do
48
+ @options = { :pager => { :pageIndex => 2} }
49
+ end
50
+
51
+ it { lambda { Kaltura::MediaEntry.list(@options) }.should_not raise_error }
52
+ end
53
+
54
+ describe "shouldn't be the same as the first page" do
55
+ before do
56
+ @first_page = Kaltura::MediaEntry.list
57
+ @second_page = Kaltura::MediaEntry.list(:pager => {:pageIndex => 2})
58
+ end
59
+
60
+ it { @fist_page.should_not eql(@second_page) }
61
+ end
62
+ end
63
+
64
+ context "filtering" do
65
+ describe "should be able to filter." do
66
+ before do
67
+ @options = { :filter => { :orderBy => "%2BcreatedAt" } }
68
+ end
69
+
70
+ it { lambda { Kaltura::MediaEntry.list(@options) }.should_not raise_error }
71
+ end
72
+
73
+ describe "filtering should work." do
74
+ before do
75
+ @first_page = Kaltura::MediaEntry.list(:filter => { :orderBy => "-createdAt" })
76
+ @second_page = Kaltura::MediaEntry.list(:filter => { :orderBy => "%2BcreatedAt" })
77
+ end
78
+
79
+ it { @first_page.should_not eql(@second_page) }
80
+ end
81
+ end
82
+
83
+ context "updating an entry" do
84
+ before do
85
+ @entry = Kaltura::MediaEntry.get('0_2vk9wpn9')
86
+ end
87
+
88
+ describe "should not raise an error" do
89
+ it { lambda { @entry.update(:category => "") }.should_not raise_error }
90
+ end
91
+ describe "should be able to update existing entry." do
92
+ it "should update the tags wihtout an error" do
93
+ @entry.update(:tags => "harvard, youtube").should be_an_instance_of Kaltura::MediaEntry
94
+ end
95
+ it "should persist the change in the original media entry." do
96
+ @entry.update(:tags => "Youtube, harvard")
97
+ @entry.tags.should eq("Youtube, harvard")
98
+ end
99
+ end
100
+ end
101
+ end
102
+ end
@@ -0,0 +1,28 @@
1
+ require 'spec_helper'
2
+
3
+ describe Kaltura::Session do
4
+ use_vcr_cassette
5
+
6
+ context "starting a session" do
7
+ describe "should begin a session with proper credentials." do
8
+ before do
9
+ Kaltura.configure do |config|
10
+ config.partner_id = 1
11
+ config.administrator_secret = 'superdupersecret'
12
+ config.service_url = 'http://www.kaltura.com'
13
+ end
14
+ @session = Kaltura::Session.start
15
+ end
16
+
17
+ it { @session.result.should be_an_instance_of String }
18
+ it { Kaltura::Session.kaltura_session.should eq(@session.result) }
19
+ end
20
+ describe "should not begin a session with invalid credentials." do
21
+ before do
22
+ Kaltura.configure { |config| config.partner_id = 2 }
23
+ end
24
+
25
+ it { lambda {Kaltura::Session.start}.should raise_error Kaltura::KalturaError }
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,17 @@
1
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
3
+ require 'rspec'
4
+ require 'kaltura'
5
+ require 'vcr'
6
+
7
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
8
+
9
+ VCR.config do |c|
10
+ c.cassette_library_dir = 'spec/cassettes'
11
+ c.stub_with :webmock
12
+ c.default_cassette_options = { :record => :once }
13
+ end
14
+
15
+ RSpec.configure do |config|
16
+ config.extend VCR::RSpec::Macros
17
+ end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: kaltura
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.1
5
+ version: 0.1.0
6
6
  platform: ruby
7
7
  authors:
8
8
  - Patrick Robertson
@@ -10,10 +10,64 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-08-20 00:00:00 -04:00
13
+ date: 2011-08-26 00:00:00 -04:00
14
14
  default_executable:
15
- dependencies: []
16
-
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: httparty
18
+ prerelease: false
19
+ requirement: &id001 !ruby/object:Gem::Requirement
20
+ none: false
21
+ requirements:
22
+ - - ">="
23
+ - !ruby/object:Gem::Version
24
+ version: 0.7.8
25
+ type: :runtime
26
+ version_requirements: *id001
27
+ - !ruby/object:Gem::Dependency
28
+ name: hashie
29
+ prerelease: false
30
+ requirement: &id002 !ruby/object:Gem::Requirement
31
+ none: false
32
+ requirements:
33
+ - - ">="
34
+ - !ruby/object:Gem::Version
35
+ version: 1.0.0
36
+ type: :runtime
37
+ version_requirements: *id002
38
+ - !ruby/object:Gem::Dependency
39
+ name: rspec
40
+ prerelease: false
41
+ requirement: &id003 !ruby/object:Gem::Requirement
42
+ none: false
43
+ requirements:
44
+ - - ~>
45
+ - !ruby/object:Gem::Version
46
+ version: 2.6.0
47
+ type: :development
48
+ version_requirements: *id003
49
+ - !ruby/object:Gem::Dependency
50
+ name: vcr
51
+ prerelease: false
52
+ requirement: &id004 !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ~>
56
+ - !ruby/object:Gem::Version
57
+ version: 1.11.1
58
+ type: :development
59
+ version_requirements: *id004
60
+ - !ruby/object:Gem::Dependency
61
+ name: webmock
62
+ prerelease: false
63
+ requirement: &id005 !ruby/object:Gem::Requirement
64
+ none: false
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: "1.7"
69
+ type: :development
70
+ version_requirements: *id005
17
71
  description: A ruby client for the Kaltura API.
18
72
  email:
19
73
  - patricksrobertson@gmail.com
@@ -25,11 +79,24 @@ extra_rdoc_files: []
25
79
 
26
80
  files:
27
81
  - .gitignore
82
+ - .rspec
28
83
  - Gemfile
29
84
  - Rakefile
30
85
  - kaltura.gemspec
31
86
  - lib/kaltura.rb
87
+ - lib/kaltura/client_resource.rb
88
+ - lib/kaltura/configuration.rb
89
+ - lib/kaltura/error.rb
90
+ - lib/kaltura/extensions/mash.rb
91
+ - lib/kaltura/media_entry.rb
92
+ - lib/kaltura/session.rb
32
93
  - lib/kaltura/version.rb
94
+ - spec/cassettes/Kaltura_MediaEntry.yml
95
+ - spec/cassettes/Kaltura_Session.yml
96
+ - spec/kaltura/configuration_spec.rb
97
+ - spec/kaltura/media_entry_spec.rb
98
+ - spec/kaltura/session_spec.rb
99
+ - spec/spec_helper.rb
33
100
  has_rdoc: true
34
101
  homepage: https://github.com/patricksrobertson/kaltura
35
102
  licenses: []
@@ -58,5 +125,10 @@ rubygems_version: 1.6.2
58
125
  signing_key:
59
126
  specification_version: 3
60
127
  summary: A ruby client for the Kaltura API.
61
- test_files: []
62
-
128
+ test_files:
129
+ - spec/cassettes/Kaltura_MediaEntry.yml
130
+ - spec/cassettes/Kaltura_Session.yml
131
+ - spec/kaltura/configuration_spec.rb
132
+ - spec/kaltura/media_entry_spec.rb
133
+ - spec/kaltura/session_spec.rb
134
+ - spec/spec_helper.rb