12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
# File 'lib/oass/client/campaign.rb', line 12
def create_campaign(attributes)
request "Campaign" do |xml|
xml.Campaign(:action => "add") do
xml.Overview do
xml.Id attributes[:id]
xml.AdvertiserId attributes[:advertiser_id]
xml.Name attributes[:name]
xml.AgencyId attributes[:agency_id]
xml.Description attributes[:description] if attributes[:description]
xml.CampaignManager attributes[:campaign_manager] if attributes[:campaign_manager]
xml.ProductId attributes[:product_id]
xml.ExternalUsers do
attributes[:external_users].each do |user_id|
xml.UserId user_id
end
end if attributes[:external_users]
xml.InternalQuickReport attributes[:internal_quick_report] if attributes[:internal_quick_report]
xml.ExternalQuickReport attributes[:external_quick_report] if attributes[:external_quick_report]
end
if schedule = attributes[:schedule]
xml.Schedule do
xml.Impressions schedule[:impressions] if schedule[:impressions]
xml.Clicks schedule[:clicks] if schedule[:clicks]
xml.Uniques schedule[:uniques] if schedule[:uniques]
xml.Weight schedule[:weight] if schedule[:weight]
xml.PriorityLevel schedule[:priority_level] if schedule[:priority_level]
xml.Completion schedule[:completion] if schedule[:completion]
xml.StartDate schedule[:start_date] if schedule[:start_date]
xml.EndDate schedule[:end_date] if schedule[:end_date]
xml.Reach schedule[:reach] if schedule[:reach]
xml.DailyImp schedule[:daily_impressions] if schedule[:daily_impressions]
xml.DailyClicks schedule[:daily_clicks] if schedule[:daily_clicks]
xml.DailyUniq schedule[:daily_uniq] if schedule[:daily_uniq]
xml.SmoothOrAsap schedule[:smooth_or_asap] if schedule[:smooth_or_asap]
xml.ImpOverrun schedule[:impression_overrun] if schedule[:impression_overrun]
xml.CompanionPositions do
schedule[:companion_positions].each do |position|
xml.CompanionPosition position
end
end if schedule[:companion_positions]
xml.StrictCompanions schedule[:strict_companions] if schedule[:strict_companions]
if primary_frequency = schedule[:primary_frequency]
xml.PrimaryFrequency do
xml.ImpPerVisitor primary_frequency[:impression_per_visitor]
xml.ClickPerVisitor primary_frequency[:click_per_visitor]
xml.FreqScope primary_frequency[:frequency_scope]
end
end
if secondary_frequency = schedule[:primary_frequency]
xml.SecondaryFrequency do
xml.ImpPerVisitor secondary_frequency[:impression_per_visitor]
xml.FreqScope secondary_frequency[:frequency_scope]
end
end
xml.HourOfDay do
schedule[:hours_of_day].each do |hour|
xml.Hour hour
end
end if schedule[:hours_of_day]
xml.DayOfWeek do
schedule[:days_of_week].each do |day|
xml.Day day
end
end if schedule[:days_of_week]
xml.UserTimeZone schedule[:user_time_zone] if schedule[:user_time_zone]
xml.Sections do
schedule[:sections].each do |section|
xml.SectionId section
end
end if schedule[:sections]
end
end
end
end
end
|