Class: YandexDirect::Client

Inherits:
Object
  • Object
show all
Includes:
V5::API
Defined in:
lib/yandex_direct.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from V5::VCards

#add_v_cards, #v_cards

Methods included from V5::Sitelinks

#add_sitelinks, #sitelinks

Methods included from V5::Keywords

#add_keywords, #keywords

Methods included from V5::Dictionaries

#dictionaries

Methods included from V5::Campaigns

#add_campaigns, #campaigns

Methods included from V5::AdImages

#ad_images, #add_ad_images

Methods included from V5::AdGroups

#ad_groups, #add_ad_groups

Methods included from V5::Ads

#add_ads, #ads, #moderate_ads

Constructor Details

#initialize(options = {}) {|_self| ... } ⇒ Client

Returns a new instance of Client.

Yields:

  • (_self)

Yield Parameters:



19
20
21
22
23
24
25
26
27
28
# File 'lib/yandex_direct.rb', line 19

def initialize(options = {})
  options.each do |key, value|
    instance_variable_set("@#{key}", value)
  end

  @url = 'https://api.direct.yandex.ru/json-api/v4/'
  @url_live = 'https://api.direct.yandex.ru/live/v4/json/'

  yield(self) if block_given?
end

Instance Attribute Details

#app_idObject

Returns the value of attribute app_id.



16
17
18
# File 'lib/yandex_direct.rb', line 16

def app_id
  @app_id
end

#available_unitsObject (readonly)

Returns the value of attribute available_units.



17
18
19
# File 'lib/yandex_direct.rb', line 17

def available_units
  @available_units
end

#loginObject

Returns the value of attribute login.



16
17
18
# File 'lib/yandex_direct.rb', line 16

def 
  @login
end

#testObject

Returns the value of attribute test.



16
17
18
# File 'lib/yandex_direct.rb', line 16

def test
  @test
end

#tokenObject

Returns the value of attribute token.



16
17
18
# File 'lib/yandex_direct.rb', line 16

def token
  @token
end

Instance Method Details

#banners_tags(param) ⇒ Object



62
63
64
# File 'lib/yandex_direct.rb', line 62

def banners_tags(param)
  request_live('GetBannersTags', param)
end

#campaigns_tags(param) ⇒ Object



54
55
56
# File 'lib/yandex_direct.rb', line 54

def campaigns_tags(param)
  request_live('GetCampaignsTags', param)
end

#create_new_wordstat_report(param = nil) ⇒ Object



30
31
32
33
# File 'lib/yandex_direct.rb', line 30

def create_new_wordstat_report(param = nil)
  param ||= { Phrases: ['синтепон'], GeoID: [213] }
  request('CreateNewWordstatReport', param)['data']
end

#delete_wordstat_report(param) ⇒ Object



35
36
37
# File 'lib/yandex_direct.rb', line 35

def delete_wordstat_report(param)
  request('DeleteWordstatReport', param)
end

#ping_apiObject



66
67
68
# File 'lib/yandex_direct.rb', line 66

def ping_api
  request('PingAPI')
end

#update_banners_tags(param) ⇒ Object



58
59
60
# File 'lib/yandex_direct.rb', line 58

def update_banners_tags(param)
  request_live('UpdateBannersTags', param)
end

#update_campaigns_tags(param) ⇒ Object



50
51
52
# File 'lib/yandex_direct.rb', line 50

def update_campaigns_tags(param)
  request_live('UpdateCampaignsTags', param)
end

#wordstat_report(param) ⇒ Object



39
40
41
42
43
44
# File 'lib/yandex_direct.rb', line 39

def wordstat_report(param)
  result = request('GetWordstatReport', param)
  raise(YandexDirect::BlankDataError, 'Blank data') if result['data'].empty?

  result
end

#wordstat_report_listObject



46
47
48
# File 'lib/yandex_direct.rb', line 46

def wordstat_report_list
  request('GetWordstatReportList')
end