vj-sdk 0.6.9 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/VERSION.yml +2 -2
- data/lib/videojuicer.rb +1 -2
- data/lib/videojuicer/asset/all.rb +45 -0
- data/spec/assets/all.rb +41 -0
- data/spec/presentation_spec.rb +1 -1
- data/vj-sdk.gemspec +7 -10
- metadata +9 -11
- data/lib/videojuicer/assets.rb +0 -46
- data/lib/videojuicer/criterion/time.rb +0 -26
- data/spec/assets_spec.rb +0 -24
- data/spec/criterion/time_spec.rb +0 -23
data/Rakefile
CHANGED
@@ -13,7 +13,7 @@ begin
|
|
13
13
|
gem.summary = "Videojuicer core-sdk"
|
14
14
|
gem.email = "dan@videojuicer.com"
|
15
15
|
gem.homepage = "http://github.com/videojuicer/vj-sdk"
|
16
|
-
gem.authors = ["danski", "thejohnny", "knowtheory", "sixones", "btab"]
|
16
|
+
gem.authors = ["danski", "thejohnny", "knowtheory", "sixones", "btab", "lamp"]
|
17
17
|
|
18
18
|
# Declare dependencies
|
19
19
|
gem.add_dependency "json", ">= 1.0"
|
data/VERSION.yml
CHANGED
data/lib/videojuicer.rb
CHANGED
@@ -37,7 +37,7 @@ require 'videojuicer/user'
|
|
37
37
|
require 'videojuicer/campaign'
|
38
38
|
require 'videojuicer/insert'
|
39
39
|
require 'videojuicer/presentation'
|
40
|
-
require 'videojuicer/
|
40
|
+
require 'videojuicer/asset/all'
|
41
41
|
require 'videojuicer/asset/audio'
|
42
42
|
require 'videojuicer/asset/document'
|
43
43
|
require 'videojuicer/asset/flash'
|
@@ -47,7 +47,6 @@ require 'videojuicer/asset/video'
|
|
47
47
|
require 'videojuicer/criterion/date_range'
|
48
48
|
require 'videojuicer/criterion/geolocation'
|
49
49
|
require 'videojuicer/criterion/request'
|
50
|
-
require 'videojuicer/criterion/time'
|
51
50
|
require 'videojuicer/criterion/week_day'
|
52
51
|
require 'videojuicer/preset'
|
53
52
|
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module Videojuicer
|
2
|
+
module Asset
|
3
|
+
class All
|
4
|
+
|
5
|
+
include Videojuicer::Resource
|
6
|
+
include Videojuicer::Exceptions
|
7
|
+
|
8
|
+
property :name, String
|
9
|
+
property :friendly_name, String
|
10
|
+
property :type, String
|
11
|
+
property :http_url, String
|
12
|
+
property :created_at, DateTime
|
13
|
+
property :updated_at, DateTime
|
14
|
+
|
15
|
+
def self.singular_name
|
16
|
+
"asset"
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.base_path(options={})
|
20
|
+
"/assets"
|
21
|
+
end
|
22
|
+
|
23
|
+
def derive(preset)
|
24
|
+
response = proxy_for(config).post(resource_path, :preset_id => preset.id)
|
25
|
+
self.class.new(JSON.parse(response.body))
|
26
|
+
end
|
27
|
+
|
28
|
+
def returnable_attributes
|
29
|
+
attrs = super
|
30
|
+
attrs.delete(:file) unless new_record?
|
31
|
+
attrs
|
32
|
+
end
|
33
|
+
|
34
|
+
def set_derived(from_asset, preset)
|
35
|
+
params = {
|
36
|
+
:original_asset_type => from_asset.class.to_s.split("::").last,
|
37
|
+
:original_asset_id => from_asset.id,
|
38
|
+
:preset_id => preset.id
|
39
|
+
}
|
40
|
+
response = proxy_for(config).post(resource_path(:set_derived), params)
|
41
|
+
self.attributes = JSON.parse(response.body)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
data/spec/assets/all.rb
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
require File.join(File.dirname(__FILE__), "..", "helpers", "spec_helper")
|
2
|
+
|
3
|
+
describe Videojuicer::Asset::All do
|
4
|
+
|
5
|
+
before :all do
|
6
|
+
configure_test_settings
|
7
|
+
5.of do
|
8
|
+
Videojuicer::Asset::Video.gen :friendly_name => "test"
|
9
|
+
end
|
10
|
+
@klass = Videojuicer::Asset::All
|
11
|
+
end
|
12
|
+
|
13
|
+
describe "instantiation" do
|
14
|
+
it_should_behave_like "a configurable"
|
15
|
+
end
|
16
|
+
|
17
|
+
describe "listing assets of all types" do
|
18
|
+
|
19
|
+
it "should list assets" do
|
20
|
+
@assets = @klass.all
|
21
|
+
@assets.should_not == nil
|
22
|
+
@assets.class.should == Videojuicer::Resource::Collection
|
23
|
+
end
|
24
|
+
|
25
|
+
it "should paginate" do
|
26
|
+
@assets = @klass.all :page => 1, :limit => 5
|
27
|
+
@assets.length.should == 5
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
|
32
|
+
describe "searching" do
|
33
|
+
it "should search" do
|
34
|
+
@assets = @klass.all({"friendly_name.like" => "test"})
|
35
|
+
@assets.should_not == nil
|
36
|
+
@assets.class.should == Videojuicer::Resource::Collection
|
37
|
+
@assets.first.friendly_name.should =~ /test/
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
data/spec/presentation_spec.rb
CHANGED
@@ -100,7 +100,7 @@ describe Videojuicer::Presentation do
|
|
100
100
|
@presentation.has_default_content?.should == false
|
101
101
|
end
|
102
102
|
|
103
|
-
it "should return false if there is any
|
103
|
+
it "should return false if there is any markup in the document_content" do
|
104
104
|
@presentation.document_content = "{% image %}{% id 1 %}{% endimage %} <br/>"
|
105
105
|
@presentation.has_default_content?.should == false
|
106
106
|
end
|
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.
|
8
|
+
s.version = "0.7.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = ["danski", "thejohnny", "knowtheory", "sixones", "btab"]
|
12
|
-
s.date = %q{2010-
|
11
|
+
s.authors = ["danski", "thejohnny", "knowtheory", "sixones", "btab", "lamp"]
|
12
|
+
s.date = %q{2010-12-14}
|
13
13
|
s.email = %q{dan@videojuicer.com}
|
14
14
|
s.extra_rdoc_files = [
|
15
15
|
"LICENSE",
|
@@ -28,6 +28,7 @@ Gem::Specification.new do |s|
|
|
28
28
|
"lib/core_ext/object.rb",
|
29
29
|
"lib/core_ext/string.rb",
|
30
30
|
"lib/videojuicer.rb",
|
31
|
+
"lib/videojuicer/asset/all.rb",
|
31
32
|
"lib/videojuicer/asset/audio.rb",
|
32
33
|
"lib/videojuicer/asset/base.rb",
|
33
34
|
"lib/videojuicer/asset/document.rb",
|
@@ -35,12 +36,10 @@ Gem::Specification.new do |s|
|
|
35
36
|
"lib/videojuicer/asset/image.rb",
|
36
37
|
"lib/videojuicer/asset/text.rb",
|
37
38
|
"lib/videojuicer/asset/video.rb",
|
38
|
-
"lib/videojuicer/assets.rb",
|
39
39
|
"lib/videojuicer/campaign.rb",
|
40
40
|
"lib/videojuicer/criterion/date_range.rb",
|
41
41
|
"lib/videojuicer/criterion/geolocation.rb",
|
42
42
|
"lib/videojuicer/criterion/request.rb",
|
43
|
-
"lib/videojuicer/criterion/time.rb",
|
44
43
|
"lib/videojuicer/criterion/week_day.rb",
|
45
44
|
"lib/videojuicer/insert.rb",
|
46
45
|
"lib/videojuicer/oauth/multipart_helper.rb",
|
@@ -63,20 +62,19 @@ Gem::Specification.new do |s|
|
|
63
62
|
"lib/videojuicer/shared/exceptions.rb",
|
64
63
|
"lib/videojuicer/shared/liquid_helper.rb",
|
65
64
|
"lib/videojuicer/user.rb",
|
65
|
+
"spec/assets/all.rb",
|
66
66
|
"spec/assets/audio_spec.rb",
|
67
67
|
"spec/assets/document_spec.rb",
|
68
68
|
"spec/assets/flash_spec.rb",
|
69
69
|
"spec/assets/image_spec.rb",
|
70
70
|
"spec/assets/text_spec.rb",
|
71
71
|
"spec/assets/video_spec.rb",
|
72
|
-
"spec/assets_spec.rb",
|
73
72
|
"spec/belongs_to_spec.rb",
|
74
73
|
"spec/campaign_spec.rb",
|
75
74
|
"spec/collection_spec.rb",
|
76
75
|
"spec/criterion/date_range_spec.rb",
|
77
76
|
"spec/criterion/geolocation_spec.rb",
|
78
77
|
"spec/criterion/request_spec.rb",
|
79
|
-
"spec/criterion/time_spec.rb",
|
80
78
|
"spec/criterion/week_day_spec.rb",
|
81
79
|
"spec/files/audio.mp3",
|
82
80
|
"spec/files/document.js",
|
@@ -113,20 +111,19 @@ Gem::Specification.new do |s|
|
|
113
111
|
s.rubygems_version = %q{1.3.7}
|
114
112
|
s.summary = %q{Videojuicer core-sdk}
|
115
113
|
s.test_files = [
|
116
|
-
"spec/assets/
|
114
|
+
"spec/assets/all.rb",
|
115
|
+
"spec/assets/audio_spec.rb",
|
117
116
|
"spec/assets/document_spec.rb",
|
118
117
|
"spec/assets/flash_spec.rb",
|
119
118
|
"spec/assets/image_spec.rb",
|
120
119
|
"spec/assets/text_spec.rb",
|
121
120
|
"spec/assets/video_spec.rb",
|
122
|
-
"spec/assets_spec.rb",
|
123
121
|
"spec/belongs_to_spec.rb",
|
124
122
|
"spec/campaign_spec.rb",
|
125
123
|
"spec/collection_spec.rb",
|
126
124
|
"spec/criterion/date_range_spec.rb",
|
127
125
|
"spec/criterion/geolocation_spec.rb",
|
128
126
|
"spec/criterion/request_spec.rb",
|
129
|
-
"spec/criterion/time_spec.rb",
|
130
127
|
"spec/criterion/week_day_spec.rb",
|
131
128
|
"spec/has_spec.rb",
|
132
129
|
"spec/helpers/be_equal_to.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:
|
4
|
+
hash: 3
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
-
|
10
|
-
version: 0.
|
8
|
+
- 7
|
9
|
+
- 0
|
10
|
+
version: 0.7.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- danski
|
@@ -15,11 +15,12 @@ authors:
|
|
15
15
|
- knowtheory
|
16
16
|
- sixones
|
17
17
|
- btab
|
18
|
+
- lamp
|
18
19
|
autorequire:
|
19
20
|
bindir: bin
|
20
21
|
cert_chain: []
|
21
22
|
|
22
|
-
date: 2010-
|
23
|
+
date: 2010-12-14 00:00:00 +00:00
|
23
24
|
default_executable:
|
24
25
|
dependencies:
|
25
26
|
- !ruby/object:Gem::Dependency
|
@@ -107,6 +108,7 @@ files:
|
|
107
108
|
- lib/core_ext/object.rb
|
108
109
|
- lib/core_ext/string.rb
|
109
110
|
- lib/videojuicer.rb
|
111
|
+
- lib/videojuicer/asset/all.rb
|
110
112
|
- lib/videojuicer/asset/audio.rb
|
111
113
|
- lib/videojuicer/asset/base.rb
|
112
114
|
- lib/videojuicer/asset/document.rb
|
@@ -114,12 +116,10 @@ files:
|
|
114
116
|
- lib/videojuicer/asset/image.rb
|
115
117
|
- lib/videojuicer/asset/text.rb
|
116
118
|
- lib/videojuicer/asset/video.rb
|
117
|
-
- lib/videojuicer/assets.rb
|
118
119
|
- lib/videojuicer/campaign.rb
|
119
120
|
- lib/videojuicer/criterion/date_range.rb
|
120
121
|
- lib/videojuicer/criterion/geolocation.rb
|
121
122
|
- lib/videojuicer/criterion/request.rb
|
122
|
-
- lib/videojuicer/criterion/time.rb
|
123
123
|
- lib/videojuicer/criterion/week_day.rb
|
124
124
|
- lib/videojuicer/insert.rb
|
125
125
|
- lib/videojuicer/oauth/multipart_helper.rb
|
@@ -142,20 +142,19 @@ files:
|
|
142
142
|
- lib/videojuicer/shared/exceptions.rb
|
143
143
|
- lib/videojuicer/shared/liquid_helper.rb
|
144
144
|
- lib/videojuicer/user.rb
|
145
|
+
- spec/assets/all.rb
|
145
146
|
- spec/assets/audio_spec.rb
|
146
147
|
- spec/assets/document_spec.rb
|
147
148
|
- spec/assets/flash_spec.rb
|
148
149
|
- spec/assets/image_spec.rb
|
149
150
|
- spec/assets/text_spec.rb
|
150
151
|
- spec/assets/video_spec.rb
|
151
|
-
- spec/assets_spec.rb
|
152
152
|
- spec/belongs_to_spec.rb
|
153
153
|
- spec/campaign_spec.rb
|
154
154
|
- spec/collection_spec.rb
|
155
155
|
- spec/criterion/date_range_spec.rb
|
156
156
|
- spec/criterion/geolocation_spec.rb
|
157
157
|
- spec/criterion/request_spec.rb
|
158
|
-
- spec/criterion/time_spec.rb
|
159
158
|
- spec/criterion/week_day_spec.rb
|
160
159
|
- spec/files/audio.mp3
|
161
160
|
- spec/files/document.js
|
@@ -220,20 +219,19 @@ signing_key:
|
|
220
219
|
specification_version: 3
|
221
220
|
summary: Videojuicer core-sdk
|
222
221
|
test_files:
|
222
|
+
- spec/assets/all.rb
|
223
223
|
- spec/assets/audio_spec.rb
|
224
224
|
- spec/assets/document_spec.rb
|
225
225
|
- spec/assets/flash_spec.rb
|
226
226
|
- spec/assets/image_spec.rb
|
227
227
|
- spec/assets/text_spec.rb
|
228
228
|
- spec/assets/video_spec.rb
|
229
|
-
- spec/assets_spec.rb
|
230
229
|
- spec/belongs_to_spec.rb
|
231
230
|
- spec/campaign_spec.rb
|
232
231
|
- spec/collection_spec.rb
|
233
232
|
- spec/criterion/date_range_spec.rb
|
234
233
|
- spec/criterion/geolocation_spec.rb
|
235
234
|
- spec/criterion/request_spec.rb
|
236
|
-
- spec/criterion/time_spec.rb
|
237
235
|
- spec/criterion/week_day_spec.rb
|
238
236
|
- spec/has_spec.rb
|
239
237
|
- spec/helpers/be_equal_to.rb
|
data/lib/videojuicer/assets.rb
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
module Videojuicer
|
2
|
-
class Assets
|
3
|
-
|
4
|
-
include Videojuicer::Resource
|
5
|
-
include Videojuicer::Exceptions
|
6
|
-
|
7
|
-
property :name, String
|
8
|
-
property :type, String
|
9
|
-
property :created_at, DateTime
|
10
|
-
property :updated_at, DateTime
|
11
|
-
|
12
|
-
def self.singular_name
|
13
|
-
"asset"
|
14
|
-
end
|
15
|
-
|
16
|
-
def self.base_path(options={})
|
17
|
-
"/assets"
|
18
|
-
end
|
19
|
-
|
20
|
-
def derive(preset)
|
21
|
-
response = proxy_for(config).post(resource_path, :preset_id => preset.id)
|
22
|
-
self.class.new(JSON.parse(response.body))
|
23
|
-
end
|
24
|
-
|
25
|
-
def file
|
26
|
-
raise "use the value of #{self.class}#url to download a copy of the asset"
|
27
|
-
end
|
28
|
-
|
29
|
-
def returnable_attributes
|
30
|
-
attrs = super
|
31
|
-
attrs.delete(:file) unless new_record?
|
32
|
-
attrs
|
33
|
-
end
|
34
|
-
|
35
|
-
def set_derived(from_asset, preset)
|
36
|
-
params = {
|
37
|
-
:original_asset_type => from_asset.class.to_s.split("::").last,
|
38
|
-
:original_asset_id => from_asset.id,
|
39
|
-
:preset_id => preset.id
|
40
|
-
}
|
41
|
-
response = proxy_for(config).post(resource_path(:set_derived), params)
|
42
|
-
self.attributes = JSON.parse(response.body)
|
43
|
-
end
|
44
|
-
|
45
|
-
end
|
46
|
-
end
|
@@ -1,26 +0,0 @@
|
|
1
|
-
module Videojuicer
|
2
|
-
module Criterion
|
3
|
-
class Time
|
4
|
-
|
5
|
-
include Videojuicer::Resource
|
6
|
-
|
7
|
-
belongs_to :campaign, :class=>Videojuicer::Campaign
|
8
|
-
|
9
|
-
property :campaign_id, Integer
|
10
|
-
property :until, DateTime
|
11
|
-
property :from, DateTime
|
12
|
-
|
13
|
-
def self.singular_name
|
14
|
-
"criterion"
|
15
|
-
end
|
16
|
-
|
17
|
-
def self.base_path(options={})
|
18
|
-
"/criteria/#{self.to_s.split("::").last.snake_case}"
|
19
|
-
end
|
20
|
-
|
21
|
-
def matcher_keys
|
22
|
-
[:until, :from]
|
23
|
-
end
|
24
|
-
end
|
25
|
-
end
|
26
|
-
end
|
data/spec/assets_spec.rb
DELETED
@@ -1,24 +0,0 @@
|
|
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
|
data/spec/criterion/time_spec.rb
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__), "..", "helpers", "spec_helper")
|
2
|
-
|
3
|
-
describe Videojuicer::Criterion::Time do
|
4
|
-
|
5
|
-
before(:all) do
|
6
|
-
@klass = Videojuicer::Criterion::Time
|
7
|
-
configure_test_settings
|
8
|
-
end
|
9
|
-
|
10
|
-
describe "instantiation" do
|
11
|
-
it_should_behave_like "a configurable"
|
12
|
-
end
|
13
|
-
|
14
|
-
describe "general interface:" do
|
15
|
-
before(:all) do
|
16
|
-
@singular_name = "criterion"
|
17
|
-
@plural_name = "criteria/time"
|
18
|
-
end
|
19
|
-
|
20
|
-
it_should_behave_like "a RESTFUL resource model"
|
21
|
-
end
|
22
|
-
|
23
|
-
end
|