naver-searchad-api 1.1.0 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d995bc1205a2da26be62626195e2dbea8f3bcb73359723fb1a986db0ce92af7d
|
4
|
+
data.tar.gz: 3d3a33bf8e6350f00324678f66726f2b0629b635860e2fac7f157938a41ef0d2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 29b82364755db7c1a86c9f38bf0642cb5cf55b6166ed3eb1ee48b069efabe8cfe60fbec5cca1e6600a2110f5e7d76e17632144ba8642e957ae524c6cc719002d
|
7
|
+
data.tar.gz: '09a458bc2f823af00c759e2b17bc7165665ab62369c99dbb19fc0d5078a4e189cbb435b05876354f47c448b90b734f114104c946eec46b410520a9bed9771278'
|
@@ -7,12 +7,14 @@ require_relative '../version'
|
|
7
7
|
require_relative 'api_command'
|
8
8
|
require_relative 'download_command'
|
9
9
|
require_relative 'logging'
|
10
|
+
require_relative 'helpers'
|
10
11
|
|
11
12
|
module Naver
|
12
13
|
module Searchad
|
13
14
|
module Api
|
14
15
|
module Core
|
15
16
|
class BaseService
|
17
|
+
include Helpers
|
16
18
|
include Logging
|
17
19
|
|
18
20
|
attr_accessor :request_options
|
@@ -42,7 +44,7 @@ module Naver
|
|
42
44
|
protected
|
43
45
|
|
44
46
|
def make_command(method, path, options = {})
|
45
|
-
template =
|
47
|
+
template = new_template(url + base_path + path)
|
46
48
|
command = ApiCommand.new(method, template)
|
47
49
|
command.decode_snake_case = options.fetch(:decode_snake_case, true) if options
|
48
50
|
command.options = request_options.merge(options)
|
@@ -51,7 +53,7 @@ module Naver
|
|
51
53
|
end
|
52
54
|
|
53
55
|
def make_download_command(method, path, options = {})
|
54
|
-
template =
|
56
|
+
template = new_template(url + base_path + path)
|
55
57
|
command = DownloadCommand.new(method, template)
|
56
58
|
command.options = request_options.merge(options)
|
57
59
|
apply_command_defaults(command)
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'naver/searchad/api'
|
2
|
+
|
3
|
+
module Naver
|
4
|
+
module Searchad
|
5
|
+
module Api
|
6
|
+
module Core
|
7
|
+
module Helpers
|
8
|
+
private
|
9
|
+
|
10
|
+
def new_template(url)
|
11
|
+
Addressable::Template.new(remove_excessive_fslashes_from_url(url))
|
12
|
+
end
|
13
|
+
|
14
|
+
def remove_excessive_fslashes_from_url(url)
|
15
|
+
tmp = Addressable::URI.parse(url)
|
16
|
+
tmp.path = tmp.path.squeeze('/')
|
17
|
+
tmp.to_s
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -4,12 +4,14 @@ require 'json'
|
|
4
4
|
require_relative '../errors'
|
5
5
|
require_relative '../options'
|
6
6
|
require_relative 'logging'
|
7
|
+
require_relative 'helpers'
|
7
8
|
|
8
9
|
module Naver
|
9
10
|
module Searchad
|
10
11
|
module Api
|
11
12
|
module Core
|
12
13
|
class HttpCommand
|
14
|
+
include Helpers
|
13
15
|
include Logging
|
14
16
|
|
15
17
|
attr_reader :url
|
@@ -22,7 +24,7 @@ module Naver
|
|
22
24
|
|
23
25
|
def initialize(method, url, body: nil)
|
24
26
|
@options = RequestOptions.default.dup
|
25
|
-
@url = url.is_a?(String) ?
|
27
|
+
@url = url.is_a?(String) ? new_template(url) : url
|
26
28
|
@method = method
|
27
29
|
@header = {}
|
28
30
|
@body = body
|
@@ -21,18 +21,18 @@ module Naver
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def get_stat_report(report_job_id, options: {}, &block)
|
24
|
-
command = make_command(:get, '
|
24
|
+
command = make_command(:get, 'stat-reports/{report_job_id}', options)
|
25
25
|
command.params['report_job_id'] = report_job_id
|
26
26
|
execute_command(command, &block)
|
27
27
|
end
|
28
28
|
|
29
29
|
def list_stat_reports(options: {}, &block)
|
30
|
-
command = make_command(:get, '
|
30
|
+
command = make_command(:get, 'stat-reports', options)
|
31
31
|
execute_command(command, &block)
|
32
32
|
end
|
33
33
|
|
34
34
|
def create_stat_report(type, date, options: {}, &block)
|
35
|
-
command = make_command(:post, '
|
35
|
+
command = make_command(:post, 'stat-reports', options)
|
36
36
|
command.request_object = {
|
37
37
|
'reportTp' => type,
|
38
38
|
'statDt' => date
|
@@ -41,12 +41,12 @@ module Naver
|
|
41
41
|
end
|
42
42
|
|
43
43
|
def delete_stat_reports(options: {}, &block)
|
44
|
-
command = make_command(:delete, '
|
44
|
+
command = make_command(:delete, 'stat-reports', options)
|
45
45
|
execute_command(command, &block)
|
46
46
|
end
|
47
47
|
|
48
48
|
def delete_stat_report(report_job_id, options: {}, &block)
|
49
|
-
command = make_command(:delete, '
|
49
|
+
command = make_command(:delete, 'stat-reports/{report_job_id}', options)
|
50
50
|
command.params['report_job_id'] = report_job_id
|
51
51
|
execute_command(command, &block)
|
52
52
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: naver-searchad-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Min Kim
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-01-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httpclient
|
@@ -129,6 +129,7 @@ files:
|
|
129
129
|
- lib/naver/searchad/api/core/api_command.rb
|
130
130
|
- lib/naver/searchad/api/core/base_service.rb
|
131
131
|
- lib/naver/searchad/api/core/download_command.rb
|
132
|
+
- lib/naver/searchad/api/core/helpers.rb
|
132
133
|
- lib/naver/searchad/api/core/http_command.rb
|
133
134
|
- lib/naver/searchad/api/core/logging.rb
|
134
135
|
- lib/naver/searchad/api/errors.rb
|
@@ -158,7 +159,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
158
159
|
- !ruby/object:Gem::Version
|
159
160
|
version: '0'
|
160
161
|
requirements: []
|
161
|
-
rubygems_version: 3.
|
162
|
+
rubygems_version: 3.3.7
|
162
163
|
signing_key:
|
163
164
|
specification_version: 4
|
164
165
|
summary: Naver Searchad API ruby client
|