Class: Yandex::API::Direct::BannerInfo

Inherits:
Base
  • Object
show all
Defined in:
lib/yandex-api/direct/banner_info.rb

Overview

Banner

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

arrays, attributes, direct_arrays, direct_attributes, direct_objects, #initialize, objects, #to_hash

Constructor Details

This class inherits a constructor from Yandex::API::Direct::Base

Class Method Details

.find(id) ⇒ Object

Raises:

  • (Yandex::NotFound)


55
56
57
58
59
# File 'lib/yandex-api/direct/banner_info.rb', line 55

def self.find id
  result = Direct::request('GetBanners', {:BannerIDS => [id]})
  raise Yandex::NotFound.new("not found banner where id = #{id}") unless result.any?
  banner = new(result.first)
end

Instance Method Details

#archiveObject



64
65
66
# File 'lib/yandex-api/direct/banner_info.rb', line 64

def archive
  Direct::request('ArchiveBanners', {:CampaignID => self.CampaignID, :BannerIDS => [self.BannerID]})
end

#deleteObject



79
80
81
# File 'lib/yandex-api/direct/banner_info.rb', line 79

def delete
  Direct::request('DeleteBanners', {:CampaignID => self.CampaignID, :BannerIDS => [self.BannerID]})
end

#moderateObject



70
71
72
# File 'lib/yandex-api/direct/banner_info.rb', line 70

def moderate
  Direct::request('ModerateBanners', {:CampaignID => self.CampaignID, :BannerIDS => [self.BannerID]})
end

#resumeObject



73
74
75
# File 'lib/yandex-api/direct/banner_info.rb', line 73

def resume
  Direct::request('ResumeBanners', {:CampaignID => self.CampaignID, :BannerIDS => [self.BannerID]})
end

#saveObject



60
61
62
# File 'lib/yandex-api/direct/banner_info.rb', line 60

def save
  Direct::request('CreateOrUpdateBanners', [self.to_hash]).first
end

#stopObject



76
77
78
# File 'lib/yandex-api/direct/banner_info.rb', line 76

def stop
  Direct::request('StopBanners', {:CampaignID => self.CampaignID, :BannerIDS => [self.BannerID]})
end

#unarchiveObject



67
68
69
# File 'lib/yandex-api/direct/banner_info.rb', line 67

def unarchive
  Direct::request('UnArchiveCampaign', {:CampaignID => self.CampaignID, :BannerIDS => [self.BannerID]})
end