fix json
This commit is contained in:
parent
242b2ab416
commit
93cdc5ef54
@ -27,7 +27,8 @@ class Campaign < ActiveRecord::Base
|
||||
|
||||
|
||||
def to_bettervideo_format
|
||||
campaign = self.as_json(include: :videolistings)
|
||||
campaign = self.as_json
|
||||
campaign[:videolistings] = self.videolistings.all.map {|vl| vl.as_json }
|
||||
campaigns = {campaigns: [campaign,], key: "PRO1234"}
|
||||
campaigns.to_json
|
||||
end
|
||||
|
@ -22,6 +22,19 @@ class Videolisting < ActiveRecord::Base
|
||||
self.asseturls.split(',').collect { |url| { asseturl: url.strip } }
|
||||
end
|
||||
|
||||
def as_json
|
||||
{
|
||||
assets: self.asseturls_array,
|
||||
clientprovidedscript: self.clientprovidedscript,
|
||||
musicselection: self.musicselection,
|
||||
notes: self.notes,
|
||||
producttypeid: 721,
|
||||
toneofvideo: self.toneofvideo,
|
||||
videocode: self.videocode,
|
||||
voiceoverselection: self.voiceoverselection
|
||||
}.as_json
|
||||
end
|
||||
|
||||
private
|
||||
def set_videocode
|
||||
self.videocode ||= SecureRandom.hex
|
||||
|
Loading…
Reference in New Issue
Block a user