Class: Yandex::Direct::Campaign
- Inherits:
-
Base
- Object
- Base
- Yandex::Direct::Campaign
show all
- Defined in:
- lib/yandex/direct/models/campaign.rb
Constant Summary
collapse
- ATTRIBUTES =
:Id, :Name, :ClientInfo, :StartDate, :EndDate, :TimeTargeting, :TimeZone, :NegativeKeywords,
:BlockedIps, :ExcludedSites, :DailyBudget, :Notification, :Type, :Status, :State, :StatusPayment,
:StatusClarification, :SourceId, :Statistics, :Currency, :Funds, :RepresentedBy
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
create, initialize, path, #save, #to_param
Class Method Details
.archive(selection_criteria) ⇒ Object
.delete(selection_criteria) ⇒ Object
.find(id) ⇒ Object
22
23
24
|
# File 'lib/yandex/direct/models/campaign.rb', line 22
def self.find(id)
self.where(Ids: Array(id)).call(:get).first
end
|
.get(selection_criteria) ⇒ Object
17
18
19
20
|
# File 'lib/yandex/direct/models/campaign.rb', line 17
def self.get(selection_criteria)
response = Yandex::Direct.request('get', self.path, selection_criteria.fields(*ATTRIBUTES))
Yandex::Direct.parse(response, 'Campaigns',self)
end
|
.resume(selection_criteria) ⇒ Object
.suspend(selection_criteria) ⇒ Object
.unarchive(selection_criteria) ⇒ Object
Instance Method Details
#archive ⇒ Object
31
32
33
|
# File 'lib/yandex/direct/models/campaign.rb', line 31
def archive
self.class.where(Ids: [self.Id]).call(:archive).first
end
|
#attributes ⇒ Object
10
11
12
13
14
15
|
# File 'lib/yandex/direct/models/campaign.rb', line 10
def attributes
{
:Id => nil,
:Name => nil
}
end
|
#delete ⇒ Object
67
68
69
|
# File 'lib/yandex/direct/models/campaign.rb', line 67
def delete
self.class.where(Ids: [self.Id]).call(:delete).first
end
|
#resume ⇒ Object
49
50
51
|
# File 'lib/yandex/direct/models/campaign.rb', line 49
def resume
self.class.where(Ids: [self.Id]).call(:resume).first
end
|
#suspend ⇒ Object
58
59
60
|
# File 'lib/yandex/direct/models/campaign.rb', line 58
def suspend
self.class.where(Ids: [self.Id]).call(:suspend).first
end
|
#unarchive ⇒ Object
40
41
42
|
# File 'lib/yandex/direct/models/campaign.rb', line 40
def unarchive
self.class.where(Ids: [self.Id]).call(:unarchive).first
end
|