diff --git a/app/models/campaign.rb b/app/models/campaign.rb index 568b333..5fa5a47 100644 --- a/app/models/campaign.rb +++ b/app/models/campaign.rb @@ -9,6 +9,13 @@ class Campaign < ActiveRecord::Base validates :description, presence: true validates :productsandservices, presence: true + + def init + self.clientid = 720 + end + + + after_create :send_to_better_video def send_to_better_video #TODO Make API Calls diff --git a/app/models/videolisting.rb b/app/models/videolisting.rb index 1f47c4d..a136b74 100644 --- a/app/models/videolisting.rb +++ b/app/models/videolisting.rb @@ -1,10 +1,13 @@ class Videolisting < ActiveRecord::Base belongs_to :campaign validates :videocode, presence: true, uniqueness: true - validates :producttypeid, presence: true validates :voiceoverselection, presence: true validates :musicselection, presence: true + def init + self.producttypeid = 721 + end + def asseturls_array self.asseturls.split(',').collect { |url| { asseturl: url.strip } } diff --git a/app/views/campaigns/_form.html.erb b/app/views/campaigns/_form.html.erb index 76f6322..cf6b752 100644 --- a/app/views/campaigns/_form.html.erb +++ b/app/views/campaigns/_form.html.erb @@ -26,9 +26,6 @@ <%= frm.input :listingcode, label: 'Listing Code', hint: "This should be the same as Intake Form's Form Hash." %> - <%= frm.input :clientid, - label: 'Client ID', - hint: 'An identifier provided by BetterVideo.' %> <%= frm.input :description, label: 'Description', as: 'text', diff --git a/app/views/campaigns/_videolisting.html.erb b/app/views/campaigns/_videolisting.html.erb index d5c85b3..d4eaa13 100644 --- a/app/views/campaigns/_videolisting.html.erb +++ b/app/views/campaigns/_videolisting.html.erb @@ -3,10 +3,6 @@ Video Code <%= videolisting.videocode %> - - Video Type - <%= producttypeid_list item:videolisting.producttypeid %> - Voiceover Selection <%= voiceoverselection_list item:videolisting.voiceoverselection %> diff --git a/app/views/campaigns/_videolisting.json.jbuilder b/app/views/campaigns/_videolisting.json.jbuilder index 139d68d..95a649b 100644 --- a/app/views/campaigns/_videolisting.json.jbuilder +++ b/app/views/campaigns/_videolisting.json.jbuilder @@ -1,7 +1,5 @@ json.assets videolisting.asseturls_array if videolisting.asseturls_array json.clientprovidedscript videolisting.clientprovidedscript if videolisting.clientprovidedscript -json.focus videolisting.focus if videolisting.focus -json.keywords videolisting.keywords if videolisting.keywords json.musicselection videolisting.musicselection if videolisting.musicselection json.notes videolisting.notes if videolisting.notes json.producttypeid videolisting.producttypeid if videolisting.producttypeid diff --git a/app/views/campaigns/_videolisting_fields.html.erb b/app/views/campaigns/_videolisting_fields.html.erb index 712f12f..ea5a1a1 100644 --- a/app/views/campaigns/_videolisting_fields.html.erb +++ b/app/views/campaigns/_videolisting_fields.html.erb @@ -2,10 +2,6 @@ <%= f.input :videocode, label: 'Video Code', hint: "Unique identifier for every video." %> - <%= f.input :producttypeid, - label: "Product Type", - collection: producttypeid_list, - hint: "What type of content to create for this video. The types available are dependant on the pre-defined list of products." %> <%= f.input :voiceoverselection, label: 'Voiceover Selection', collection: voiceoverselection_list, diff --git a/app/views/campaigns/index.html.erb b/app/views/campaigns/index.html.erb index 45fd0b4..ba4d950 100644 --- a/app/views/campaigns/index.html.erb +++ b/app/views/campaigns/index.html.erb @@ -4,7 +4,6 @@ Listing Code(Form Hash) Processed? - Client ID Billing Code Address City @@ -20,7 +19,6 @@ <%= link_to campaign.listingcode, campaign_path(campaign.listingcode) %> - <%= campaign.clientid %> <%= campaign.billingcode %> <%= campaign.address %> <%= campaign.city %> diff --git a/app/views/campaigns/show.html.erb b/app/views/campaigns/show.html.erb index c93c555..3d1c7d1 100644 --- a/app/views/campaigns/show.html.erb +++ b/app/views/campaigns/show.html.erb @@ -14,10 +14,6 @@ Listing Code <%= @campaign.listingcode %> - - Client Id - <%= @campaign.clientid %> - Description <%= @campaign.description %>