Class: Naver::Searchad::Api::StatReport::Service

Inherits:
Core::BaseService show all
Defined in:
lib/naver/searchad/api/stat-report/service.rb

Instance Attribute Summary

Attributes inherited from Core::BaseService

#base_path, #client_options, #request_options, #url

Instance Method Summary collapse

Methods inherited from Core::BaseService

#authorization, #authorization=, #client

Methods included from Core::Logging

#logger

Constructor Details

#initializeService

Returns a new instance of Service.



10
11
12
# File 'lib/naver/searchad/api/stat-report/service.rb', line 10

def initialize
  super('https://api.naver.com/', '')
end

Instance Method Details

#create_stat_report(type, date, options: {}, &block) ⇒ Object



34
35
36
37
38
39
40
41
# File 'lib/naver/searchad/api/stat-report/service.rb', line 34

def create_stat_report(type, date, options: {}, &block)
  command = make_command(:post, '/stat-reports', options)
  command.request_object = {
    'reportTp' => type,
    'statDt' => date
  }
  execute_command(command, &block)
end

#delete_stat_report(report_job_id, options: {}, &block) ⇒ Object



48
49
50
51
52
# File 'lib/naver/searchad/api/stat-report/service.rb', line 48

def delete_stat_report(report_job_id, options: {}, &block)
  command = make_command(:delete, '/stat-reports/{report_job_id}', options)
  command.params['report_job_id'] = report_job_id
  execute_command(command, &block)
end

#delete_stat_reports(options: {}, &block) ⇒ Object



43
44
45
46
# File 'lib/naver/searchad/api/stat-report/service.rb', line 43

def delete_stat_reports(options: {}, &block)
  command = make_command(:delete, '/stat-reports', options)
  execute_command(command, &block)
end

#download_report(download_url, file_path, options: {}, &block) ⇒ Object



14
15
16
17
18
19
20
21
# File 'lib/naver/searchad/api/stat-report/service.rb', line 14

def download_report(download_url, file_path, options: {}, &block)
  uri = Addressable::URI.parse(download_url)

  command = make_download_command(:get, uri.path, options)
  command.query['authtoken'] = uri.query_values['authtoken']
  command.download_dest = file_path
  execute_command(command, &block)
end

#get_stat_report(report_job_id, options: {}, &block) ⇒ Object



23
24
25
26
27
# File 'lib/naver/searchad/api/stat-report/service.rb', line 23

def get_stat_report(report_job_id, options: {}, &block)
  command = make_command(:get, '/stat-reports/{report_job_id}', options)
  command.params['report_job_id'] = report_job_id
  execute_command(command, &block)
end

#list_stat_reports(options: {}, &block) ⇒ Object



29
30
31
32
# File 'lib/naver/searchad/api/stat-report/service.rb', line 29

def list_stat_reports(options: {}, &block)
  command = make_command(:get, '/stat-reports', options)
  execute_command(command, &block)
end