click_house 2.0.1 → 2.0.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: 67e6a326b4ad9972ca7713c935a6b4b1d03da9b3a1e4150119a6bd88cd63481e
4
- data.tar.gz: 5face2f1ed1c776b822e023fe862525b94cd3349055ce1a7135a0d184d493196
3
+ metadata.gz: c2d62b43147b81ad3551c48c79388a949307d03491c1d87965d25ae9818e0a86
4
+ data.tar.gz: ad6e79c3a974e4e39889d93dcabd94d3dc8f2bced9b739449f741bd1c8c83038
5
5
  SHA512:
6
- metadata.gz: c3f9f7f4962e323684324fd863a487a46440aec742c06e8e406abe88c56f5457795e5b03d1367a206da45b3f912fb237428c1bc9251120e0f28272517d283a5a
7
- data.tar.gz: 70795ae32a9e0c555de49034fa19f3863459ea267b3e29aa85ff185f675dfacd15633d8c345f31d90ae2e6e95721187afc700fb40e891a6b5129ecc92ef87f6f
6
+ metadata.gz: 9035db18ecc851ab6de8f9ae88d434dfff07f2da5e23eac4cf3c091fe699871c64f0c9c05a1637730f44dfd5fef4eca60f6cd94f613360113152461f7e4dabe8
7
+ data.tar.gz: bb93033b9ffc82a7003af0affea015ad2a84292a86a50c46ea6cecfa232b22d172708dc1633f896fd29eea373270eb464baa70e02df8d036195d0aeb2f88f29c
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- click_house (2.0.1)
4
+ click_house (2.0.2)
5
5
  activesupport
6
6
  faraday (>= 1.7, < 3)
7
7
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- click_house (1.7.0)
4
+ click_house (2.0.1)
5
5
  activesupport
6
6
  faraday (>= 1.7, < 3)
7
7
 
@@ -47,13 +47,22 @@ module ClickHouse
47
47
  end
48
48
 
49
49
  # transport should work the same both with Faraday v1 and Faraday v2
50
+ # rubocop:disable Metrics/AbcSize
50
51
  def transport
51
52
  @transport ||= Faraday.new(config.url!) do |conn|
52
53
  conn.options.timeout = config.timeout
53
54
  conn.options.open_timeout = config.open_timeout
54
55
  conn.headers = config.headers
55
56
  conn.ssl.verify = config.ssl_verify
56
- conn.request(:basic_auth, config.username, config.password) if config.auth?
57
+
58
+ if config.auth?
59
+ if faraday_v1?
60
+ conn.request :basic_auth, config.username, config.password
61
+ else
62
+ conn.request :authorization, :basic, config.username, config.password
63
+ end
64
+ end
65
+
57
66
  conn.response Middleware::RaiseError
58
67
  conn.response Middleware::Logging, logger: config.logger!
59
68
  conn.response config.json_parser, content_type: %r{application/json}, parser_options: { config: config }
@@ -61,10 +70,16 @@ module ClickHouse
61
70
  conn.adapter config.adapter
62
71
  end
63
72
  end
73
+ # rubocop:enable Metrics/AbcSize
64
74
 
65
75
  def compose(path, query = {})
66
76
  # without <query.compact> "DB::Exception: Empty query" error will occur
67
77
  "#{path}?#{URI.encode_www_form({ send_progress_in_http_headers: 1 }.merge(query).compact)}"
68
78
  end
79
+
80
+ # @return [Boolean]
81
+ def faraday_v1?
82
+ Faraday::VERSION.start_with?('1')
83
+ end
69
84
  end
70
85
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ClickHouse
4
- VERSION = '2.0.1'
4
+ VERSION = '2.0.2'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: click_house
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.1
4
+ version: 2.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aliaksandr Shylau