Class: YandexApiDirect::Client

Inherits:
Hashr
  • Object
show all
Extended by:
YandexObject
Includes:
YandexObject
Defined in:
lib/yandex-api-direct/yandex_objects/client.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.find(params = {}) ⇒ Object

perform find call


12
13
14
15
16
# File 'lib/yandex-api-direct/yandex_objects/client.rb', line 12

def self.find params = {}
  call_method("get_clients_list", params)[:data].collect do |client_args|
    new client_args
  end
end

Instance Method Details

#campaignsObject

get campaigns by client


19
20
21
22
23
# File 'lib/yandex-api-direct/yandex_objects/client.rb', line 19

def campaigns
  call_method("get_campaigns_list", [])[:data].collect do |campaign_args|
    Campaign.new campaign_args
  end
end

#campaigns_stats(args) ⇒ Object

get campaign stats for client by campaigns input args:

start_date: Date
end_date: Date


31
32
33
34
35
36
# File 'lib/yandex-api-direct/yandex_objects/client.rb', line 31

def campaigns_stats args
  campaigns.collect do |campaign|
    campaign.stats = campaign.campaign_stats(args.merge(campaign_ids: [campaign.campaign_id])).select{|s| s.campaign_id == campaign.campaign_id}
    campaign
  end
end