vj-sdk 0.6.7 → 0.6.8

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION.yml CHANGED
@@ -2,4 +2,4 @@
2
2
  :major: 0
3
3
  :build:
4
4
  :minor: 6
5
- :patch: 7
5
+ :patch: 8
@@ -0,0 +1,41 @@
1
+ module Videojuicer
2
+ class Assets
3
+
4
+ include Videojuicer::Resource
5
+ include Videojuicer::Exceptions
6
+
7
+ def self.singular_name
8
+ "asset"
9
+ end
10
+
11
+ def self.base_path(options={})
12
+ "/assets"
13
+ end
14
+
15
+ def derive(preset)
16
+ response = proxy_for(config).post(resource_path, :preset_id => preset.id)
17
+ self.class.new(JSON.parse(response.body))
18
+ end
19
+
20
+ def file
21
+ raise "use the value of #{self.class}#url to download a copy of the asset"
22
+ end
23
+
24
+ def returnable_attributes
25
+ attrs = super
26
+ attrs.delete(:file) unless new_record?
27
+ attrs
28
+ end
29
+
30
+ def set_derived(from_asset, preset)
31
+ params = {
32
+ :original_asset_type => from_asset.class.to_s.split("::").last,
33
+ :original_asset_id => from_asset.id,
34
+ :preset_id => preset.id
35
+ }
36
+ response = proxy_for(config).post(resource_path(:set_derived), params)
37
+ self.attributes = JSON.parse(response.body)
38
+ end
39
+
40
+ end
41
+ end
@@ -67,5 +67,21 @@ module Videojuicer
67
67
  end
68
68
  end
69
69
 
70
+ def has_default_content?
71
+ asset_ids
72
+ return false if video_assets.length > 1
73
+
74
+ types = @@asset_types.dup
75
+ types.delete "video"
76
+
77
+ types.inject(true) do |memo, type|
78
+ unless send("#{type}_asset_ids").nil?
79
+ return false
80
+ else
81
+ true
82
+ end
83
+ end
84
+ end
85
+
70
86
  end
71
87
  end
data/lib/videojuicer.rb CHANGED
@@ -37,6 +37,7 @@ require 'videojuicer/user'
37
37
  require 'videojuicer/campaign'
38
38
  require 'videojuicer/insert'
39
39
  require 'videojuicer/presentation'
40
+ require 'videojuicer/assets'
40
41
  require 'videojuicer/asset/audio'
41
42
  require 'videojuicer/asset/document'
42
43
  require 'videojuicer/asset/flash'
@@ -0,0 +1,24 @@
1
+ require File.join(File.dirname(__FILE__), "helpers", "spec_helper")
2
+
3
+ describe Videojuicer::Assets do
4
+
5
+ before :each do
6
+ @klass = Videojuicer::Assets
7
+ @preset_params = {:derived_type => "Audio", :file_format => "mp3"}
8
+ configure_test_settings
9
+ end
10
+
11
+ describe "instantiation" do
12
+ it_should_behave_like "a configurable"
13
+ end
14
+
15
+ describe "listing assets of all types" do
16
+
17
+ it "should list assets" do
18
+ @assets = Videojuicer::Assets.all
19
+ p @assets
20
+ @assets.class.should == Array
21
+ end
22
+ end
23
+
24
+ end
@@ -84,6 +84,26 @@ describe Videojuicer::Presentation do
84
84
  end
85
85
  end
86
86
 
87
+ describe "default document_content detection" do
88
+
89
+ before :each do
90
+ @presentation = Videojuicer::Presentation.gen
91
+ @presentation.document_content = "{% video %}{% id 8003 %}{% endvideo %}"
92
+ end
93
+
94
+ it "should know it has the default document_content" do
95
+ p @presentation.document_content
96
+ @presentation.has_default_content?.should == true
97
+ end
98
+
99
+ it "should know it doesn't have the default document_content" do
100
+ @presentation.document_content = "{% image %}{% id 1 %}{% endimage %}"
101
+ p @presentation.document_content
102
+ @presentation.has_default_content?.should == false
103
+ end
104
+
105
+ end
106
+
87
107
  end
88
108
 
89
109
 
data/vj-sdk.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{vj-sdk}
8
- s.version = "0.6.7"
8
+ s.version = "0.6.8"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["danski", "thejohnny", "knowtheory", "sixones", "btab"]
12
- s.date = %q{2010-11-15}
12
+ s.date = %q{2010-11-24}
13
13
  s.email = %q{dan@videojuicer.com}
14
14
  s.extra_rdoc_files = [
15
15
  "LICENSE",
@@ -35,6 +35,7 @@ Gem::Specification.new do |s|
35
35
  "lib/videojuicer/asset/image.rb",
36
36
  "lib/videojuicer/asset/text.rb",
37
37
  "lib/videojuicer/asset/video.rb",
38
+ "lib/videojuicer/assets.rb",
38
39
  "lib/videojuicer/campaign.rb",
39
40
  "lib/videojuicer/criterion/date_range.rb",
40
41
  "lib/videojuicer/criterion/geolocation.rb",
@@ -68,6 +69,7 @@ Gem::Specification.new do |s|
68
69
  "spec/assets/image_spec.rb",
69
70
  "spec/assets/text_spec.rb",
70
71
  "spec/assets/video_spec.rb",
72
+ "spec/assets_spec.rb",
71
73
  "spec/belongs_to_spec.rb",
72
74
  "spec/campaign_spec.rb",
73
75
  "spec/collection_spec.rb",
@@ -117,6 +119,7 @@ Gem::Specification.new do |s|
117
119
  "spec/assets/image_spec.rb",
118
120
  "spec/assets/text_spec.rb",
119
121
  "spec/assets/video_spec.rb",
122
+ "spec/assets_spec.rb",
120
123
  "spec/belongs_to_spec.rb",
121
124
  "spec/campaign_spec.rb",
122
125
  "spec/collection_spec.rb",
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vj-sdk
3
3
  version: !ruby/object:Gem::Version
4
- hash: 9
4
+ hash: 23
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 6
9
- - 7
10
- version: 0.6.7
9
+ - 8
10
+ version: 0.6.8
11
11
  platform: ruby
12
12
  authors:
13
13
  - danski
@@ -19,7 +19,7 @@ autorequire:
19
19
  bindir: bin
20
20
  cert_chain: []
21
21
 
22
- date: 2010-11-15 00:00:00 +00:00
22
+ date: 2010-11-24 00:00:00 +00:00
23
23
  default_executable:
24
24
  dependencies:
25
25
  - !ruby/object:Gem::Dependency
@@ -114,6 +114,7 @@ files:
114
114
  - lib/videojuicer/asset/image.rb
115
115
  - lib/videojuicer/asset/text.rb
116
116
  - lib/videojuicer/asset/video.rb
117
+ - lib/videojuicer/assets.rb
117
118
  - lib/videojuicer/campaign.rb
118
119
  - lib/videojuicer/criterion/date_range.rb
119
120
  - lib/videojuicer/criterion/geolocation.rb
@@ -147,6 +148,7 @@ files:
147
148
  - spec/assets/image_spec.rb
148
149
  - spec/assets/text_spec.rb
149
150
  - spec/assets/video_spec.rb
151
+ - spec/assets_spec.rb
150
152
  - spec/belongs_to_spec.rb
151
153
  - spec/campaign_spec.rb
152
154
  - spec/collection_spec.rb
@@ -224,6 +226,7 @@ test_files:
224
226
  - spec/assets/image_spec.rb
225
227
  - spec/assets/text_spec.rb
226
228
  - spec/assets/video_spec.rb
229
+ - spec/assets_spec.rb
227
230
  - spec/belongs_to_spec.rb
228
231
  - spec/campaign_spec.rb
229
232
  - spec/collection_spec.rb