Class: Naver::Searchad::Api::Campaign::Service
Instance Attribute Summary
#base_path, #client_options, #request_options, #url
Instance Method Summary
collapse
-
#create_campaign(campaign, options: nil, &block) ⇒ Object
-
#delete_campaign(campaign_id, options: nil, &block) ⇒ Object
-
#get_campaign(campaign_id, options: nil, &block) ⇒ Object
-
#initialize ⇒ Service
constructor
A new instance of Service.
-
#list_campaigns(options: nil, &block) ⇒ Object
-
#list_campaigns_by_ids(campaign_ids, options: nil, &block) ⇒ Object
-
#update_campaign(campaign, field: nil, options: nil, &block) ⇒ Object
#authorization, #authorization=, #client
#logger
Constructor Details
Returns a new instance of Service.
9
10
11
|
# File 'lib/naver/searchad/api/campaign/service.rb', line 9
def initialize
super('https://api.naver.com/', 'ncc/')
end
|
Instance Method Details
#create_campaign(campaign, options: nil, &block) ⇒ Object
30
31
32
33
34
35
36
|
# File 'lib/naver/searchad/api/campaign/service.rb', line 30
def create_campaign(campaign, options: nil, &block)
validates_presence_of(%w[campaignTp name customerId], campaign)
command = make_command(:post, 'campaigns', options)
command.request_object = campaign
execute_command(command, &block)
end
|
#delete_campaign(campaign_id, options: nil, &block) ⇒ Object
48
49
50
51
52
|
# File 'lib/naver/searchad/api/campaign/service.rb', line 48
def delete_campaign(campaign_id, options: nil, &block)
command = make_command(:delete, 'campaigns/{campaign_id}', options)
command.params['campaign_id'] = campaign_id
execute_command(command, &block)
end
|
#get_campaign(campaign_id, options: nil, &block) ⇒ Object
24
25
26
27
28
|
# File 'lib/naver/searchad/api/campaign/service.rb', line 24
def get_campaign(campaign_id, options: nil, &block)
command = make_command(:get, 'campaigns/{campaign_id}', options)
command.params['campaign_id'] = campaign_id
execute_command(command, &block)
end
|
#list_campaigns(options: nil, &block) ⇒ Object
13
14
15
16
|
# File 'lib/naver/searchad/api/campaign/service.rb', line 13
def list_campaigns(options: nil, &block)
command = make_command(:get, 'campaigns', options)
execute_command(command, &block)
end
|
#list_campaigns_by_ids(campaign_ids, options: nil, &block) ⇒ Object
18
19
20
21
22
|
# File 'lib/naver/searchad/api/campaign/service.rb', line 18
def list_campaigns_by_ids(campaign_ids, options: nil, &block)
command = make_command(:get, 'campaigns/', options)
command.query['ids'] = campaign_ids.join(',')
execute_command(command, &block)
end
|
#update_campaign(campaign, field: nil, options: nil, &block) ⇒ Object
38
39
40
41
42
43
44
45
46
|
# File 'lib/naver/searchad/api/campaign/service.rb', line 38
def update_campaign(campaign, field: nil, options: nil, &block)
validates_presence_of(%w[nccCampaignId], campaign)
command = make_command(:put, 'campaigns/{campaign_id}', options)
command.params['campaign_id'] = campaign['nccCampaignId']
command.query['fields'] = field if field
command.request_object = campaign
execute_command(command, &block)
end
|