vj-sdk 0.5.4 → 0.5.5

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
  :build:
3
3
  :major: 0
4
4
  :minor: 5
5
- :patch: 4
5
+ :patch: 5pre
@@ -16,7 +16,11 @@ module Bundler
16
16
 
17
17
  # NEW METHOD
18
18
  ordered_deps = []
19
- spec_names = specs_for(*groups).map { |s| s.name }
19
+ begin # this is done because of an api change between 0.9.10 and 0.9.15
20
+ spec_names = specs_for(*groups).map { |s| s.name }
21
+ rescue
22
+ spec_names = specs_for(groups).map { |s| s.name }
23
+ end
20
24
  @definition.dependencies.each do |dep|
21
25
  ordered_deps << dep if spec_names.include?(dep.name) && !ordered_deps.include?(dep)
22
26
  end
data/lib/videojuicer.rb CHANGED
@@ -22,6 +22,7 @@ require 'videojuicer/oauth/proxy_factory'
22
22
  require 'videojuicer/resource/embeddable'
23
23
  require 'videojuicer/resource/types'
24
24
  require 'videojuicer/resource/relationships/belongs_to'
25
+ require 'videojuicer/resource/relationships/has'
25
26
  require 'videojuicer/resource/errors'
26
27
  require 'videojuicer/resource/collection'
27
28
  require 'videojuicer/resource/inferrable'
@@ -32,7 +33,7 @@ require 'videojuicer/session'
32
33
  require 'videojuicer/seed'
33
34
  require 'videojuicer/user'
34
35
  require 'videojuicer/campaign'
35
- require 'videojuicer/campaign_policy'
36
+ require 'videojuicer/insert'
36
37
  require 'videojuicer/presentation'
37
38
  require 'videojuicer/asset/audio'
38
39
  require 'videojuicer/asset/document'
@@ -40,13 +41,11 @@ require 'videojuicer/asset/flash'
40
41
  require 'videojuicer/asset/image'
41
42
  require 'videojuicer/asset/text'
42
43
  require 'videojuicer/asset/video'
43
- require 'videojuicer/promo/base'
44
44
  require 'videojuicer/criterion/date_range'
45
45
  require 'videojuicer/criterion/geolocation'
46
46
  require 'videojuicer/criterion/request'
47
47
  require 'videojuicer/criterion/time'
48
48
  require 'videojuicer/criterion/week_day'
49
- require 'videojuicer/promo/base'
50
49
  require 'videojuicer/preset'
51
50
 
52
51
  module Videojuicer
@@ -3,17 +3,18 @@ module Videojuicer
3
3
  include Videojuicer::Resource
4
4
  include Videojuicer::Exceptions
5
5
 
6
- property :name, String
7
- property :user_id, Integer
8
- property :created_at, DateTime
9
- property :updated_at, DateTime
6
+ property :name, String
7
+ property :user_id, Integer
8
+ property :target_type, String
9
+ property :target_id, Integer
10
+ property :disclosure, String
11
+ property :created_at, DateTime
12
+ property :updated_at, DateTime
13
+
10
14
  belongs_to :user, :class=>Videojuicer::User
11
15
 
12
- attr_accessor :campaign_policies
13
- def campaign_policies=(arg)
14
- # Loop over and make objects or something
15
- @campaign_policies=(arg)
16
- end
17
-
16
+ attr_accessor :criteria
17
+ attr_accessor :targets
18
+ attr_accessor :inserts
18
19
  end
19
20
  end
@@ -1,12 +1,23 @@
1
- require File.join(File.dirname(__FILE__), "base")
2
-
3
1
  module Videojuicer
4
2
  module Criterion
5
- class DateRange < Base
3
+ class DateRange
6
4
 
5
+ include Videojuicer::Resource
6
+
7
+ belongs_to :campaign, :class=>Videojuicer::Campaign
8
+
9
+ property :campaign_id, Integer
7
10
  property :until, DateTime
8
11
  property :from, DateTime
9
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
+
10
21
  def matcher_keys
11
22
  [:until, :from]
12
23
  end
@@ -1,14 +1,25 @@
1
- require File.join(File.dirname(__FILE__), "base")
2
-
3
1
  module Videojuicer
4
2
  module Criterion
5
- class Geolocation < Base
3
+ class Geolocation
4
+
5
+ include Videojuicer::Resource
6
6
 
7
+ belongs_to :campaign, :class=>Videojuicer::Campaign
8
+
9
+ property :campaign_id, Integer
7
10
  property :country, String
8
11
  property :region, String
9
12
  property :city, String
10
13
  property :exclude, Boolean
11
14
 
15
+ def self.singular_name
16
+ "criterion"
17
+ end
18
+
19
+ def self.base_path(options={})
20
+ "/criteria/#{self.to_s.split("::").last.snake_case}"
21
+ end
22
+
12
23
  def matcher_keys
13
24
  [:country, :region, :city, :exclude]
14
25
  end
@@ -1,12 +1,23 @@
1
- require File.join(File.dirname(__FILE__), "base")
2
-
3
1
  module Videojuicer
4
2
  module Criterion
5
- class Request < Base
3
+ class Request
6
4
 
5
+ include Videojuicer::Resource
6
+
7
+ belongs_to :campaign, :class=>Videojuicer::Campaign
8
+
9
+ property :campaign_id, Integer
7
10
  property :referrer, String, :nullable => false
8
11
  property :exclude, Boolean
9
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
+
10
21
  def matcher_keys
11
22
  [:referrer, :exclude]
12
23
  end
@@ -1,12 +1,23 @@
1
- require File.join(File.dirname(__FILE__), "base")
2
-
3
1
  module Videojuicer
4
2
  module Criterion
5
- class Time < Base
3
+ class Time
6
4
 
5
+ include Videojuicer::Resource
6
+
7
+ belongs_to :campaign, :class=>Videojuicer::Campaign
8
+
9
+ property :campaign_id, Integer
7
10
  property :until, DateTime
8
11
  property :from, DateTime
9
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
+
10
21
  def matcher_keys
11
22
  [:until, :from]
12
23
  end
@@ -1,8 +1,12 @@
1
- require File.join(File.dirname(__FILE__), "base")
2
-
3
1
  module Videojuicer
4
2
  module Criterion
5
- class WeekDay < Base
3
+ class WeekDay
4
+
5
+ include Videojuicer::Resource
6
+
7
+ belongs_to :campaign, :class=>Videojuicer::Campaign
8
+
9
+ property :campaign_id, Integer
6
10
  property :monday, Boolean
7
11
  property :tuesday, Boolean
8
12
  property :wednesday, Boolean
@@ -12,6 +16,14 @@ module Videojuicer
12
16
  property :sunday, Boolean
13
17
  property :exclude, Boolean
14
18
 
19
+ def self.singular_name
20
+ "criterion"
21
+ end
22
+
23
+ def self.base_path(options={})
24
+ "/criteria/#{self.to_s.split("::").last.snake_case}"
25
+ end
26
+
15
27
  def matcher_keys
16
28
  [:monday, :tuesday, :wednesday, :thursday, :friday, :saturday, :sunday, :exclude]
17
29
  end
@@ -0,0 +1,22 @@
1
+ module Videojuicer
2
+ class Insert
3
+ include Videojuicer::Resource
4
+ include Videojuicer::Exceptions
5
+
6
+ property :campaign_id, Integer
7
+ property :role, String
8
+ property :offset_time, Integer
9
+ property :offset_x, Integer
10
+ property :offset_y, Integer
11
+ property :anchor_x, String
12
+ property :anchor_y, String
13
+ property :click_href, String
14
+ property :click_target, String
15
+ property :asset_type, String
16
+ property :asset_id, Integer
17
+ property :created_at, DateTime
18
+ property :updated_at, DateTime
19
+
20
+ belongs_to :campaign, :class=>Videojuicer::Campaign
21
+ end
22
+ end
@@ -0,0 +1,53 @@
1
+ module Videojuicer
2
+ module Resource
3
+ module Relationships
4
+ module Has
5
+
6
+ def self.included(base)
7
+ base.extend(ClassMethods)
8
+ base.include(InstanceMethods)
9
+ end
10
+
11
+ module ClassMethods
12
+
13
+ # Returns a :many quantifier for the ##has method.
14
+ def n
15
+ :many
16
+ end
17
+
18
+ def has(quantifier, name, options={})
19
+ options = {
20
+ :class=>name.to_s.capitalize,
21
+ :foreign_key=>"#{name}_id"
22
+ }.merge(options)
23
+
24
+ define_method name do
25
+ id = self.send(options[:foreign_key])
26
+ klass = (options[:class].is_a?(String))? Videojuicer.const_get(options[:class]) : options[:class]
27
+ return nil unless id
28
+ begin
29
+ return klass.get(id)
30
+ rescue Videojuicer::Exceptions::NoResource
31
+ return nil
32
+ end
33
+ end
34
+
35
+ define_method "#{name}=" do |arg|
36
+ self.send("#{options[:foreign_key]}=", arg.id)
37
+ end
38
+ end
39
+
40
+ end
41
+
42
+ module InstanceMethods
43
+
44
+ private
45
+ def write_has_one_object(object)
46
+ end
47
+
48
+ end
49
+
50
+ end
51
+ end
52
+ end
53
+ end
@@ -17,7 +17,7 @@ describe Videojuicer::Criterion::DateRange do
17
17
  @plural_name = "criteria/date_range"
18
18
  end
19
19
 
20
- it_should_behave_like "a dependent non-resource object"
20
+ it_should_behave_like "a RESTFUL resource model"
21
21
  end
22
22
 
23
23
  end
@@ -17,7 +17,7 @@ describe Videojuicer::Criterion::Geolocation do
17
17
  @plural_name = "criteria/geolocation"
18
18
  end
19
19
 
20
- it_should_behave_like "a dependent non-resource object"
20
+ it_should_behave_like "a RESTFUL resource model"
21
21
  end
22
22
 
23
23
  end
@@ -17,7 +17,7 @@ describe Videojuicer::Criterion::Request do
17
17
  @plural_name = "criteria/request"
18
18
  end
19
19
 
20
- it_should_behave_like "a dependent non-resource object"
20
+ it_should_behave_like "a RESTFUL resource model"
21
21
  end
22
22
 
23
23
  end
@@ -17,7 +17,7 @@ describe Videojuicer::Criterion::Time do
17
17
  @plural_name = "criteria/time"
18
18
  end
19
19
 
20
- it_should_behave_like "a dependent non-resource object"
20
+ it_should_behave_like "a RESTFUL resource model"
21
21
  end
22
22
 
23
23
  end
@@ -17,7 +17,7 @@ describe Videojuicer::Criterion::WeekDay do
17
17
  @plural_name = "criteria/week_day"
18
18
  end
19
19
 
20
- it_should_behave_like "a dependent non-resource object"
20
+ it_should_behave_like "a RESTFUL resource model"
21
21
  end
22
22
 
23
23
  end
data/spec/has_spec.rb ADDED
@@ -0,0 +1,7 @@
1
+ require File.join(File.dirname(__FILE__), "helpers", "spec_helper")
2
+
3
+ describe Videojuicer::Resource::Relationships::Has do
4
+
5
+
6
+
7
+ end
@@ -61,24 +61,27 @@ module Videojuicer
61
61
  }}
62
62
  end
63
63
 
64
- class Campaign
64
+ class Insert
65
65
  include FixtureHelper
66
66
  set_attribute_proc {{
67
- :name => /\w+/.gen
67
+ :campaign_id => (Campaign.first.id rescue Campaign.gen.id),
68
+ :asset_type => "com.videojuicer.core.asset.Audio",
69
+ :asset_id => (Asset::Audio.first.id rescue Asset::Audio.gen.id)
68
70
  }}
69
71
  end
70
72
 
71
- class Campaign::CampaignPolicy
73
+ class Campaign
72
74
  include FixtureHelper
73
75
  set_attribute_proc {{
74
- :campaign_id => Campaign.gen.id,
75
- :presentation_id => (Presentation.first.id rescue Presentation.gen.id)
76
+ :name => /\w+/.gen,
77
+ :target_type => "com.videojuicer.core.Presentation"
76
78
  }}
77
79
  end
78
80
 
79
81
  class Criterion::DateRange
80
82
  include FixtureHelper
81
83
  set_attribute_proc {{
84
+ :campaign_id => 1,
82
85
  :until => DateTime.send(:today) + 1,
83
86
  :from => DateTime.send(:today) - 1
84
87
  }}
@@ -87,6 +90,7 @@ module Videojuicer
87
90
  class Criterion::Geolocation
88
91
  include FixtureHelper
89
92
  set_attribute_proc {{
93
+ :campaign_id => 1,
90
94
  :city => "Columbus",
91
95
  :region => "OH",
92
96
  :country => "United States"
@@ -96,13 +100,16 @@ module Videojuicer
96
100
  class Criterion::Request
97
101
  include FixtureHelper
98
102
  set_attribute_proc {{
99
- :referrer => "http://www.google.com"
103
+ :campaign_id => 1,
104
+ :referrer => "http://www.google.com",
105
+ :exclude => false
100
106
  }}
101
107
  end
102
108
 
103
109
  class Criterion::Time
104
110
  include FixtureHelper
105
111
  set_attribute_proc {{
112
+ :campaign_id => 1,
106
113
  :from => (Time.now - 3600).strftime("%H:%M"),
107
114
  :until => (Time.now + 3600).strftime("%H:%M")
108
115
  }}
@@ -111,43 +118,9 @@ module Videojuicer
111
118
  class Criterion::WeekDay
112
119
  include FixtureHelper
113
120
  set_attribute_proc {{
114
- :monday => true
115
- }}
116
- end
117
-
118
- class Promo::Image
119
- include FixtureHelper
120
- set_attribute_proc {{
121
- :role => "Thumbnail",
122
- :href => "http://www.videojuicer.com",
123
- :asset_id => 1
124
- }}
125
- end
126
-
127
- class Promo::Audio
128
- include FixtureHelper
129
- set_attribute_proc {{
130
- :role => "Voice Over",
131
- :href => "http://www.videojuicer.com",
132
- :asset_id => 1
133
- }}
134
- end
135
-
136
- class Promo::Video
137
- include FixtureHelper
138
- set_attribute_proc {{
139
- :role => "preroll",
140
- :href => "http://www.videojuicer.com",
141
- :asset_id => 1
142
- }}
143
- end
144
-
145
- class Promo::Text
146
- include FixtureHelper
147
- set_attribute_proc {{
148
- :role => "Description",
149
- :href => "http://www.videojuicer.com",
150
- :asset_id => 1
121
+ :campaign_id => 1,
122
+ :monday => true,
123
+ :exclude => false
151
124
  }}
152
125
  end
153
126
 
@@ -0,0 +1,24 @@
1
+ require File.join(File.dirname(__FILE__), "helpers", "spec_helper")
2
+
3
+ describe Videojuicer::Insert do
4
+
5
+ before(:all) do
6
+ @klass = Videojuicer::Insert
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 = "insert"
17
+ @plural_name = "inserts"
18
+ end
19
+
20
+ it_should_behave_like "a RESTFUL resource model"
21
+ end
22
+
23
+
24
+ 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.5.4"
8
+ s.version = "0.5.5"
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-05-11}
12
+ s.date = %q{2010-05-19}
13
13
  s.email = %q{dan@videojuicer.com}
14
14
  s.extra_rdoc_files = [
15
15
  "LICENSE",
@@ -36,19 +36,17 @@ Gem::Specification.new do |s|
36
36
  "lib/videojuicer/asset/text.rb",
37
37
  "lib/videojuicer/asset/video.rb",
38
38
  "lib/videojuicer/campaign.rb",
39
- "lib/videojuicer/campaign_policy.rb",
40
- "lib/videojuicer/criterion/base.rb",
41
39
  "lib/videojuicer/criterion/date_range.rb",
42
40
  "lib/videojuicer/criterion/geolocation.rb",
43
41
  "lib/videojuicer/criterion/request.rb",
44
42
  "lib/videojuicer/criterion/time.rb",
45
43
  "lib/videojuicer/criterion/week_day.rb",
44
+ "lib/videojuicer/insert.rb",
46
45
  "lib/videojuicer/oauth/multipart_helper.rb",
47
46
  "lib/videojuicer/oauth/proxy_factory.rb",
48
47
  "lib/videojuicer/oauth/request_proxy.rb",
49
48
  "lib/videojuicer/presentation.rb",
50
49
  "lib/videojuicer/preset.rb",
51
- "lib/videojuicer/promo/base.rb",
52
50
  "lib/videojuicer/resource/base.rb",
53
51
  "lib/videojuicer/resource/collection.rb",
54
52
  "lib/videojuicer/resource/embeddable.rb",
@@ -56,6 +54,7 @@ Gem::Specification.new do |s|
56
54
  "lib/videojuicer/resource/inferrable.rb",
57
55
  "lib/videojuicer/resource/property_registry.rb",
58
56
  "lib/videojuicer/resource/relationships/belongs_to.rb",
57
+ "lib/videojuicer/resource/relationships/has.rb",
59
58
  "lib/videojuicer/resource/types.rb",
60
59
  "lib/videojuicer/seed.rb",
61
60
  "lib/videojuicer/session.rb",
@@ -69,7 +68,6 @@ Gem::Specification.new do |s|
69
68
  "spec/assets/text_spec.rb",
70
69
  "spec/assets/video_spec.rb",
71
70
  "spec/belongs_to_spec.rb",
72
- "spec/campaign_policy_spec.rb",
73
71
  "spec/campaign_spec.rb",
74
72
  "spec/collection_spec.rb",
75
73
  "spec/criterion/date_range_spec.rb",
@@ -84,15 +82,13 @@ Gem::Specification.new do |s|
84
82
  "spec/files/image.jpg",
85
83
  "spec/files/text.txt",
86
84
  "spec/files/video.mov",
85
+ "spec/has_spec.rb",
87
86
  "spec/helpers/be_equal_to.rb",
88
87
  "spec/helpers/spec_fixtures.rb",
89
88
  "spec/helpers/spec_helper.rb",
89
+ "spec/insert_spec.rb",
90
90
  "spec/presentation_spec.rb",
91
91
  "spec/preset_spec.rb",
92
- "spec/promos/audio_spec.rb",
93
- "spec/promos/image_spec.rb",
94
- "spec/promos/text_spec.rb",
95
- "spec/promos/video_spec.rb",
96
92
  "spec/property_registry_spec.rb",
97
93
  "spec/request_proxy_spec.rb",
98
94
  "spec/seed_spec.rb",
@@ -111,7 +107,7 @@ Gem::Specification.new do |s|
111
107
  s.homepage = %q{http://github.com/videojuicer/vj-sdk}
112
108
  s.rdoc_options = ["--charset=UTF-8"]
113
109
  s.require_paths = ["lib"]
114
- s.rubygems_version = %q{1.3.6}
110
+ s.rubygems_version = %q{1.3.7}
115
111
  s.summary = %q{Videojuicer core-sdk}
116
112
  s.test_files = [
117
113
  "spec/assets/audio_spec.rb",
@@ -121,7 +117,6 @@ Gem::Specification.new do |s|
121
117
  "spec/assets/text_spec.rb",
122
118
  "spec/assets/video_spec.rb",
123
119
  "spec/belongs_to_spec.rb",
124
- "spec/campaign_policy_spec.rb",
125
120
  "spec/campaign_spec.rb",
126
121
  "spec/collection_spec.rb",
127
122
  "spec/criterion/date_range_spec.rb",
@@ -129,15 +124,13 @@ Gem::Specification.new do |s|
129
124
  "spec/criterion/request_spec.rb",
130
125
  "spec/criterion/time_spec.rb",
131
126
  "spec/criterion/week_day_spec.rb",
127
+ "spec/has_spec.rb",
132
128
  "spec/helpers/be_equal_to.rb",
133
129
  "spec/helpers/spec_fixtures.rb",
134
130
  "spec/helpers/spec_helper.rb",
131
+ "spec/insert_spec.rb",
135
132
  "spec/presentation_spec.rb",
136
133
  "spec/preset_spec.rb",
137
- "spec/promos/audio_spec.rb",
138
- "spec/promos/image_spec.rb",
139
- "spec/promos/text_spec.rb",
140
- "spec/promos/video_spec.rb",
141
134
  "spec/property_registry_spec.rb",
142
135
  "spec/request_proxy_spec.rb",
143
136
  "spec/seed_spec.rb",
@@ -156,7 +149,7 @@ Gem::Specification.new do |s|
156
149
  current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
157
150
  s.specification_version = 3
158
151
 
159
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
152
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
160
153
  s.add_runtime_dependency(%q<json>, [">= 1.0"])
161
154
  s.add_runtime_dependency(%q<ruby-hmac>, [">= 0.3.2"])
162
155
  s.add_runtime_dependency(%q<mash>, [">= 0.0.3"])
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vj-sdk
3
3
  version: !ruby/object:Gem::Version
4
+ hash: 1
4
5
  prerelease: false
5
6
  segments:
6
7
  - 0
7
8
  - 5
8
- - 4
9
- version: 0.5.4
9
+ - 5
10
+ version: 0.5.5
10
11
  platform: ruby
11
12
  authors:
12
13
  - danski
@@ -18,16 +19,18 @@ autorequire:
18
19
  bindir: bin
19
20
  cert_chain: []
20
21
 
21
- date: 2010-05-11 00:00:00 +01:00
22
+ date: 2010-05-19 00:00:00 +01:00
22
23
  default_executable:
23
24
  dependencies:
24
25
  - !ruby/object:Gem::Dependency
25
26
  name: json
26
27
  prerelease: false
27
28
  requirement: &id001 !ruby/object:Gem::Requirement
29
+ none: false
28
30
  requirements:
29
31
  - - ">="
30
32
  - !ruby/object:Gem::Version
33
+ hash: 15
31
34
  segments:
32
35
  - 1
33
36
  - 0
@@ -38,9 +41,11 @@ dependencies:
38
41
  name: ruby-hmac
39
42
  prerelease: false
40
43
  requirement: &id002 !ruby/object:Gem::Requirement
44
+ none: false
41
45
  requirements:
42
46
  - - ">="
43
47
  - !ruby/object:Gem::Version
48
+ hash: 23
44
49
  segments:
45
50
  - 0
46
51
  - 3
@@ -52,9 +57,11 @@ dependencies:
52
57
  name: mash
53
58
  prerelease: false
54
59
  requirement: &id003 !ruby/object:Gem::Requirement
60
+ none: false
55
61
  requirements:
56
62
  - - ">="
57
63
  - !ruby/object:Gem::Version
64
+ hash: 25
58
65
  segments:
59
66
  - 0
60
67
  - 0
@@ -92,19 +99,17 @@ files:
92
99
  - lib/videojuicer/asset/text.rb
93
100
  - lib/videojuicer/asset/video.rb
94
101
  - lib/videojuicer/campaign.rb
95
- - lib/videojuicer/campaign_policy.rb
96
- - lib/videojuicer/criterion/base.rb
97
102
  - lib/videojuicer/criterion/date_range.rb
98
103
  - lib/videojuicer/criterion/geolocation.rb
99
104
  - lib/videojuicer/criterion/request.rb
100
105
  - lib/videojuicer/criterion/time.rb
101
106
  - lib/videojuicer/criterion/week_day.rb
107
+ - lib/videojuicer/insert.rb
102
108
  - lib/videojuicer/oauth/multipart_helper.rb
103
109
  - lib/videojuicer/oauth/proxy_factory.rb
104
110
  - lib/videojuicer/oauth/request_proxy.rb
105
111
  - lib/videojuicer/presentation.rb
106
112
  - lib/videojuicer/preset.rb
107
- - lib/videojuicer/promo/base.rb
108
113
  - lib/videojuicer/resource/base.rb
109
114
  - lib/videojuicer/resource/collection.rb
110
115
  - lib/videojuicer/resource/embeddable.rb
@@ -112,6 +117,7 @@ files:
112
117
  - lib/videojuicer/resource/inferrable.rb
113
118
  - lib/videojuicer/resource/property_registry.rb
114
119
  - lib/videojuicer/resource/relationships/belongs_to.rb
120
+ - lib/videojuicer/resource/relationships/has.rb
115
121
  - lib/videojuicer/resource/types.rb
116
122
  - lib/videojuicer/seed.rb
117
123
  - lib/videojuicer/session.rb
@@ -125,7 +131,6 @@ files:
125
131
  - spec/assets/text_spec.rb
126
132
  - spec/assets/video_spec.rb
127
133
  - spec/belongs_to_spec.rb
128
- - spec/campaign_policy_spec.rb
129
134
  - spec/campaign_spec.rb
130
135
  - spec/collection_spec.rb
131
136
  - spec/criterion/date_range_spec.rb
@@ -140,15 +145,13 @@ files:
140
145
  - spec/files/image.jpg
141
146
  - spec/files/text.txt
142
147
  - spec/files/video.mov
148
+ - spec/has_spec.rb
143
149
  - spec/helpers/be_equal_to.rb
144
150
  - spec/helpers/spec_fixtures.rb
145
151
  - spec/helpers/spec_helper.rb
152
+ - spec/insert_spec.rb
146
153
  - spec/presentation_spec.rb
147
154
  - spec/preset_spec.rb
148
- - spec/promos/audio_spec.rb
149
- - spec/promos/image_spec.rb
150
- - spec/promos/text_spec.rb
151
- - spec/promos/video_spec.rb
152
155
  - spec/property_registry_spec.rb
153
156
  - spec/request_proxy_spec.rb
154
157
  - spec/seed_spec.rb
@@ -173,23 +176,27 @@ rdoc_options:
173
176
  require_paths:
174
177
  - lib
175
178
  required_ruby_version: !ruby/object:Gem::Requirement
179
+ none: false
176
180
  requirements:
177
181
  - - ">="
178
182
  - !ruby/object:Gem::Version
183
+ hash: 3
179
184
  segments:
180
185
  - 0
181
186
  version: "0"
182
187
  required_rubygems_version: !ruby/object:Gem::Requirement
188
+ none: false
183
189
  requirements:
184
190
  - - ">="
185
191
  - !ruby/object:Gem::Version
192
+ hash: 3
186
193
  segments:
187
194
  - 0
188
195
  version: "0"
189
196
  requirements: []
190
197
 
191
198
  rubyforge_project:
192
- rubygems_version: 1.3.6
199
+ rubygems_version: 1.3.7
193
200
  signing_key:
194
201
  specification_version: 3
195
202
  summary: Videojuicer core-sdk
@@ -201,7 +208,6 @@ test_files:
201
208
  - spec/assets/text_spec.rb
202
209
  - spec/assets/video_spec.rb
203
210
  - spec/belongs_to_spec.rb
204
- - spec/campaign_policy_spec.rb
205
211
  - spec/campaign_spec.rb
206
212
  - spec/collection_spec.rb
207
213
  - spec/criterion/date_range_spec.rb
@@ -209,15 +215,13 @@ test_files:
209
215
  - spec/criterion/request_spec.rb
210
216
  - spec/criterion/time_spec.rb
211
217
  - spec/criterion/week_day_spec.rb
218
+ - spec/has_spec.rb
212
219
  - spec/helpers/be_equal_to.rb
213
220
  - spec/helpers/spec_fixtures.rb
214
221
  - spec/helpers/spec_helper.rb
222
+ - spec/insert_spec.rb
215
223
  - spec/presentation_spec.rb
216
224
  - spec/preset_spec.rb
217
- - spec/promos/audio_spec.rb
218
- - spec/promos/image_spec.rb
219
- - spec/promos/text_spec.rb
220
- - spec/promos/video_spec.rb
221
225
  - spec/property_registry_spec.rb
222
226
  - spec/request_proxy_spec.rb
223
227
  - spec/seed_spec.rb
@@ -1,116 +0,0 @@
1
- module Videojuicer
2
- class Campaign
3
- class CampaignPolicy
4
- include Videojuicer::Resource
5
-
6
- # Resource should note that this is a class within a class
7
- # Should treat parent class as parent resource
8
-
9
- property :presentation_id, Integer
10
- property :campaign_id, Integer
11
- property :created_at, DateTime
12
- property :updated_at, DateTime
13
-
14
- belongs_to :campaign
15
-
16
- attr_accessor :criteria
17
- def criteria=(object_hash)
18
- # TODO instantiate criteria in a useful object of some sort
19
-
20
- # Fail unless arg is an array
21
- # Loop over array do |mem|
22
- # if mem is a hash
23
- # instantiate as a criterion
24
-
25
-
26
- # if criterion object already on this policy
27
- # leave be
28
- # else
29
- # add_criteria(mem)
30
- # end
31
- # end
32
-
33
- # what you want to be able to do is:
34
- # policy.criteria.include?(some_criterion)
35
- @criteria = {}
36
- object_hash.map do |type_sym, criteria|
37
- @criteria[type_sym.to_sym] =
38
- criteria.map do |criterion|
39
- Videojuicer::Criterion.model_map[type_sym.to_sym].new(criterion) #rescue raise("No criteria class found for #{type_sym} in #{Videojuicer::Criterion.model_map.inspect}")
40
- end
41
- end
42
- end
43
-
44
- def criteria
45
- @criteria.values.flatten
46
- end
47
-
48
- %w(date_criteria geolocation_criteria request_criteria time_criteria week_day_criteria).each do |key|
49
- class_eval <<-DEF
50
- def #{key}
51
- @criteria[:#{key}]
52
- end
53
- DEF
54
- end
55
-
56
-
57
- def add_criteria(*criteria)
58
- responses = criteria.map do |criterion|
59
- proxy_for(config).post("#{path_for_dependents}#{criterion.class.base_path}", {:criterion => criterion.attributes})
60
- end
61
- self.reload
62
- responses
63
- end
64
-
65
- def remove_criteria(*criteria)
66
- responses = criteria.map do |criterion|
67
- proxy_for(config).delete("#{path_for_dependents}#{criterion.class.base_path}", {:criterion => criterion.attributes})
68
- end
69
- self.reload
70
- responses
71
- end
72
-
73
- def promos=(object_hash={})
74
- @promos = {}
75
- object_hash.map do |type_sym, promos|
76
- @promos[type_sym.to_sym] =
77
- promos.map do |promo|
78
- Videojuicer::Promo.model_map[type_sym.to_sym].new(promo)
79
- end
80
- end
81
- end
82
-
83
- def promos
84
- @promos.values.flatten
85
- end
86
-
87
- %w(audio images texts videos).each do |key|
88
- class_eval <<-DEF
89
- def #{key}
90
- @promos[:#{key}]
91
- end
92
- DEF
93
- end
94
-
95
- def add_promo(*promos)
96
- responses = promos.map do |promo|
97
- proxy_for(config).post("#{path_for_dependents}#{promo.class.base_path}", {:promo => promo.attributes})
98
- end
99
- self.reload
100
- responses
101
- end
102
-
103
- def remove_promo(*promos)
104
- responses = promos.map do |promo|
105
- proxy_for(config).delete("#{path_for_dependents}#{promo.class.base_path}", {:promo => promo.attributes})
106
- end
107
- self.reload
108
- responses
109
- end
110
-
111
- def path_for_dependents
112
- self.class.compile_route(self.class.nesting_route,{:campaign_policy_id => self.id, :campaign_id => self.campaign_id})
113
- end
114
- end
115
- end
116
- end
@@ -1,56 +0,0 @@
1
- module Videojuicer
2
- module Criterion
3
- def self.model_map
4
- { :date_criteria => Videojuicer::Criterion::DateRange,
5
- :geolocation_criteria => Videojuicer::Criterion::Geolocation,
6
- :request_criteria => Videojuicer::Criterion::Request,
7
- :time_criteria => Videojuicer::Criterion::Time,
8
- :week_day_criteria => Videojuicer::Criterion::WeekDay
9
- }
10
- end
11
-
12
- class Base
13
- def self.inherited(base)
14
- base.send(:include, Videojuicer::Resource)
15
- base.send(:extend, Videojuicer::Criterion::Base::ClassMethods)
16
- base.send(:include, Videojuicer::Criterion::Base::InstanceMethods)
17
- end
18
-
19
- module ClassMethods
20
- def singular_name
21
- "criterion"
22
- end
23
-
24
- def base_path(options={})
25
- "/criteria/#{self.to_s.split("::").last.snake_case}"
26
- end
27
-
28
- def get(*args); raise NoMethodError; end
29
- def all(*args); raise NoMethodError; end
30
- def first(*args); raise NoMethodError; end
31
- end
32
-
33
- module InstanceMethods
34
- def save(*args); raise NoMethodError; end
35
- def destroy(*args); raise NoMethodError; end
36
- def ==(other); self.attributes == other.attributes; end
37
- def eql?(other); self.attributes.eql?(other.attributes) end
38
- def matcher_attributes; end
39
-
40
- def matcher_attributes
41
- result = {}
42
- self.matcher_keys.each do |key|
43
- result[key] = self.send(key)
44
- end
45
- return result
46
- end
47
-
48
- def matcher_keys
49
- raise NoMethodError, "Matcher Attributes needs to be implemented for #{self.class}";
50
- end
51
-
52
- end
53
-
54
- end
55
- end
56
- end
@@ -1,72 +0,0 @@
1
- module Videojuicer
2
- module Promo
3
- def self.model_map
4
- { :audio => Videojuicer::Promo::Audio,
5
- :images => Videojuicer::Promo::Image,
6
- :texts => Videojuicer::Promo::Text,
7
- :videos => Videojuicer::Promo::Video
8
- }
9
- end
10
-
11
- class Base
12
-
13
- def self.inherited(base)
14
- base.send(:include, Videojuicer::Resource)
15
- base.send(:extend, Videojuicer::Promo::Base::ClassMethods)
16
- base.send(:include, Videojuicer::Promo::Base::InstanceMethods)
17
-
18
- base.property :campaign_policy_id, Integer
19
- base.property :asset_id, Integer
20
- base.property :role, String
21
- base.property :href, String
22
- end
23
-
24
- module ClassMethods
25
- def singular_name
26
- "promo"
27
- end
28
-
29
- def base_path(options={})
30
- "/promos/#{self.to_s.split("::").last.snake_case}"
31
- end
32
-
33
- def get(*args); raise NoMethodError; end
34
- def all(*args); raise NoMethodError; end
35
- def first(*args); raise NoMethodError; end
36
- end
37
-
38
- module InstanceMethods
39
- def save(*args); raise NoMethodError; end
40
- def destroy(*args); raise NoMethodError; end
41
- def asset
42
- Videojuicer::Asset.const_get(self.class.to_s.split("::").last).get(asset_id)
43
- end
44
- def matcher_keys
45
- [:campaign_policy_id, :asset_id, :role, :href]
46
- end
47
- def matcher_attributes
48
- matcher_keys.inject({}) do |memo, attr|
49
- memo.update(attr => self.send(attr))
50
- end
51
- end
52
- end
53
-
54
- end
55
-
56
- class Audio < Base
57
- end
58
-
59
- class Image < Base
60
- end
61
-
62
- class Text < Base
63
- end
64
-
65
- class Video < Base
66
- end
67
-
68
- class Heart < Base
69
- end
70
-
71
- end
72
- end
@@ -1,41 +0,0 @@
1
- require File.join(File.dirname(__FILE__), "helpers", "spec_helper")
2
-
3
- describe Videojuicer::Campaign::CampaignPolicy do
4
-
5
- before(:all) do
6
- @klass = Videojuicer::Campaign::CampaignPolicy
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 = "campaign_policy"
17
- @plural_name = "campaign_policies"
18
- @fixed_attributes = [:campaign_id]
19
- end
20
-
21
- it_should_behave_like "a RESTFUL resource model"
22
- end
23
-
24
- describe "adding policies" do
25
-
26
- end
27
-
28
- describe "removing policies" do
29
-
30
- end
31
-
32
- describe "adding promos" do
33
-
34
- end
35
-
36
- describe "removing promos" do
37
-
38
- end
39
-
40
-
41
- end
@@ -1,23 +0,0 @@
1
- require File.join(File.dirname(__FILE__), "..", "helpers", "spec_helper")
2
-
3
- describe Videojuicer::Promo::Audio do
4
-
5
- before(:all) do
6
- @klass = Videojuicer::Promo::Audio
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 = "promo"
17
- @plural_name = "promos/audio"
18
- end
19
-
20
- it_should_behave_like "a dependent non-resource object"
21
- end
22
-
23
- end
@@ -1,24 +0,0 @@
1
- require File.join(File.dirname(__FILE__), "..", "helpers", "spec_helper")
2
-
3
- describe Videojuicer::Promo::Image do
4
-
5
- before(:all) do
6
- @klass = Videojuicer::Promo::Image
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 = "promo"
17
- @plural_name = "promos/image"
18
- end
19
-
20
- it_should_behave_like "a dependent non-resource object"
21
- end
22
-
23
- end
24
-
@@ -1,23 +0,0 @@
1
- require File.join(File.dirname(__FILE__), "..", "helpers", "spec_helper")
2
-
3
- describe Videojuicer::Promo::Text do
4
-
5
- before(:all) do
6
- @klass = Videojuicer::Promo::Text
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 = "promo"
17
- @plural_name = "promos/text"
18
- end
19
-
20
- it_should_behave_like "a dependent non-resource object"
21
- end
22
-
23
- end
@@ -1,23 +0,0 @@
1
- require File.join(File.dirname(__FILE__), "..", "helpers", "spec_helper")
2
-
3
- describe Videojuicer::Promo::Video do
4
-
5
- before(:all) do
6
- @klass = Videojuicer::Promo::Video
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 = "promo"
17
- @plural_name = "promos/video"
18
- end
19
-
20
- it_should_behave_like "a dependent non-resource object"
21
- end
22
-
23
- end