Class: Yandex::API::Direct::CampaignInfo
- Inherits:
-
Base
- Object
- Base
- Yandex::API::Direct::CampaignInfo
show all
- Defined in:
- lib/yandex-api/direct/campaign_info.rb
Overview
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
arrays, attributes, direct_arrays, direct_attributes, direct_objects, #initialize, objects, #to_hash
Class Method Details
.find(id) ⇒ Object
78
79
80
81
82
|
# File 'lib/yandex-api/direct/campaign_info.rb', line 78
def self.find id
result = Direct::request('GetCampaignParams', {:CampaignID => id})
raise Yandex::NotFound.new("not found campaign where CampaignID = #{id}") if result.empty?
new(result)
end
|
.list ⇒ Object
83
84
85
86
87
88
89
|
# File 'lib/yandex-api/direct/campaign_info.rb', line 83
def self.list
campaigs = []
Direct::request('GetCampaignsList').each do |campaig|
campaigs << new(campaig)
end
campaigs
end
|
Instance Method Details
#archive ⇒ Object
63
64
65
|
# File 'lib/yandex-api/direct/campaign_info.rb', line 63
def archive
Direct::request('ArchiveCampaign', {:CampaignID => self.CampaignID})
end
|
#banners ⇒ Object
53
54
55
56
57
58
59
|
# File 'lib/yandex-api/direct/campaign_info.rb', line 53
def banners
banners = []
Direct::request('GetBanners', {:CampaignIDS => [self.CampaignID]}).each do |banner|
banners << BannerInfo.new(banner)
end
banners
end
|
#delete ⇒ Object
75
76
77
|
# File 'lib/yandex-api/direct/campaign_info.rb', line 75
def delete
Direct::request('DeleteCampaign', {:CampaignID => self.CampaignID})
end
|
#resume ⇒ Object
69
70
71
|
# File 'lib/yandex-api/direct/campaign_info.rb', line 69
def resume
Direct::request('ResumeCampaign', {:CampaignID => self.CampaignID})
end
|
#save ⇒ Object
60
61
62
|
# File 'lib/yandex-api/direct/campaign_info.rb', line 60
def save
Direct::request('CreateOrUpdateCampaign', self.to_hash)
end
|
#stop ⇒ Object
72
73
74
|
# File 'lib/yandex-api/direct/campaign_info.rb', line 72
def stop
Direct::request('StopCampaign', {:CampaignID => self.CampaignID})
end
|
#unarchive ⇒ Object
66
67
68
|
# File 'lib/yandex-api/direct/campaign_info.rb', line 66
def unarchive
Direct::request('UnArchiveCampaign', {:CampaignID => self.CampaignID})
end
|