Class: Naver::Searchad::Api::Stat::Service

Inherits:
Core::BaseService show all
Defined in:
lib/naver/searchad/api/stat/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.



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

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

Instance Method Details

#get_stat_by_id(id, fields, time_range, options: {}, &block) ⇒ Object



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

def get_stat_by_id(id, fields, time_range, options: {}, &block)
  command = make_command(:get, 'stats', options)
  command.query['id'] = id
  command.query['fields'] = fields.to_json
  command.query['timeRange'] = time_range.to_json
  command.query['datePreset'] = options[:date_preset] if options[:date_preset]
  command.query['timeIncrement'] = options[:time_increment] if options[:time_increment]
  command.query['breakdown'] = options[:breakdown] if options[:breakdown]

  execute_command(command, &block)
end

#get_stat_by_ids(ids, fields, time_range, options: {}, &block) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/naver/searchad/api/stat/service.rb', line 25

def get_stat_by_ids(ids, fields, time_range, options: {}, &block)
  command = make_command(:get, 'stats', options)
  command.query['ids'] = ids
  command.query['fields'] = fields.to_json
  command.query['timeRange'] = time_range.to_json
  command.query['datePreset'] = options[:date_preset] if options[:date_preset]
  command.query['timeIncrement'] = options[:time_increment] if options[:time_increment]
  command.query['breakdown'] = options[:breakdown] if options[:breakdown]

  execute_command(command, &block)
end