naver-searchad-api 1.1.1 → 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: dbbdb4eb119c7be44c31a6f42660d10e7918bdbf3eaec33c383c8e510aeeb971
4
- data.tar.gz: be943907d5d92d569d639ada5b725573159aff42c1620a659a5f5e1b804dd12a
3
+ metadata.gz: d995bc1205a2da26be62626195e2dbea8f3bcb73359723fb1a986db0ce92af7d
4
+ data.tar.gz: 3d3a33bf8e6350f00324678f66726f2b0629b635860e2fac7f157938a41ef0d2
5
5
  SHA512:
6
- metadata.gz: 72624784a5d9a4e14af4430171687c2a7b8db6ce77edc4881ab07cb09c36d3ba402828e05bb133cba597815fb79bb4760986c026171d1ccdcb9e5993b13b94bc
7
- data.tar.gz: 0620d07f41497fc6744e7fa5e458b55792692801b32f4b26abeaa56f4ac4b9493dd7d8a51ea9485aa910acf2d55543f177bb06e2a2a8d17985d7b45136152d98
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 = Addressable::Template.new(url + base_path + path)
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 = Addressable::Template.new(url + base_path + path)
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) ? Addressable::Template.new(url) : url
27
+ @url = url.is_a?(String) ? new_template(url) : url
26
28
  @method = method
27
29
  @header = {}
28
30
  @body = body
@@ -1,7 +1,7 @@
1
1
  module Naver
2
2
  module Searchad
3
3
  module Api
4
- VERSION = '1.1.1'
4
+ VERSION = '1.1.2'
5
5
 
6
6
  OS_VERSION = begin
7
7
  if RUBY_PLATFORM =~ /mswin|win32|mingw|bccwin|cygwin/
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.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: 2023-01-11 00:00:00.000000000 Z
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