queuery_client 1.0.2 → 1.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 893d3e23c931f4f67621e03306cb3523e2bf86affe3a4c7bd6958e5cd4a7aa12
4
- data.tar.gz: 1fbcebdefffabad096aee653ab255329696b8e5b6e2056f4742a619ec15e3810
3
+ metadata.gz: a5aa7c59714b2972a888c845beaaf38e220fdc0173cd746a0a73f510a1c69afd
4
+ data.tar.gz: c876ff24ba9b2d6f489d480de5fc55b74d08ab2aa0229c4cb2a74ca0914053f9
5
5
  SHA512:
6
- metadata.gz: 4e7ac1fc3d9b850fc0d7d9261c1db44664511997ec17789dd153d9faf9296af7caa689561d30cfde7e07918d43331fbd11b92a1704c9781b489bb3b17704a4e3
7
- data.tar.gz: 59ca2f54c33e271ffa93d59c224fa98ae11b729152407b5b7691413bce1ca2b4a2ec6b14f9a6c6253cade2fe1bee290aa12f6496daa821441e9d7e9092b3cf91
6
+ metadata.gz: 0c154295e3c4c676de39ee43b544ec458285044c0d797f7ec199c39589023019c7f407623745a53d2da6016a9eb1b1594240e2a1f74d0093025e9d3d73d0ab56
7
+ data.tar.gz: f7340f67c56865d1c179d062801087931db880a6f9ccbc3f5d3109438ab277a2902000e253bf6d45f8ceebf47b91f2d27fb6709e2fe305f90201d6e9fba206c7
@@ -54,7 +54,9 @@ module QueueryClient
54
54
  path_prefix: '/',
55
55
  login: options.token,
56
56
  password: options.token_secret
57
- )
57
+ ).tap do |client|
58
+ client.headers['Host'] = options.host_header if options.host_header
59
+ end
58
60
  end
59
61
 
60
62
  def options
@@ -1,5 +1,8 @@
1
1
  module QueueryClient
2
2
  class Configuration
3
+ REQUIRED_KEYS = [:endpoint, :token, :token_secret]
4
+ OPTIONAL_KEYS = [:host_header]
5
+
3
6
  def initialize(options = {})
4
7
  @options = options
5
8
  end
@@ -12,11 +15,7 @@ module QueueryClient
12
15
  @options = nil
13
16
  end
14
17
 
15
- [
16
- :endpoint,
17
- :token,
18
- :token_secret,
19
- ].each do |key|
18
+ REQUIRED_KEYS.each do |key|
20
19
  define_method(key) do
21
20
  options.fetch(key)
22
21
  end
@@ -26,6 +25,16 @@ module QueueryClient
26
25
  end
27
26
  end
28
27
 
28
+ OPTIONAL_KEYS.each do |key|
29
+ define_method(key) do
30
+ options[key]
31
+ end
32
+
33
+ define_method("#{key}=") do |value|
34
+ options[key] = value
35
+ end
36
+ end
37
+
29
38
  def merge(other)
30
39
  Configuration.new(to_h.merge(other.to_h))
31
40
  end
@@ -12,15 +12,21 @@ module QueueryClient
12
12
  end
13
13
 
14
14
  def each_row(&block)
15
+ return enum_for(:each_row) if !block_given?
16
+
15
17
  f = open
16
18
  begin
17
19
  if gzipped_object?
18
20
  f = Zlib::GzipReader.new(f)
19
21
  end
20
- RedshiftCsvFile.new(f).each(&block)
22
+ RedshiftCsvFile.new(f).each do |row|
23
+ yield row
24
+ end
21
25
  ensure
22
26
  f.close
23
27
  end
28
+
29
+ self
24
30
  end
25
31
  end
26
32
  end
@@ -3,11 +3,17 @@ module QueueryClient
3
3
  # abstract data_files :: [DataFile]
4
4
 
5
5
  def each_row(&block)
6
+ return enum_for(:each_row) if !block_given?
7
+
6
8
  data_files.each do |file|
7
9
  if file.data_object?
8
- file.each_row(&block)
10
+ file.each_row do |row|
11
+ yield row
12
+ end
9
13
  end
10
14
  end
15
+
16
+ self
11
17
  end
12
18
 
13
19
  alias each each_row
@@ -1,3 +1,3 @@
1
1
  module QueueryClient
2
- VERSION = "1.0.2"
2
+ VERSION = "1.0.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: queuery_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hidekazu Kobayashi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-07-22 00:00:00.000000000 Z
11
+ date: 2020-08-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: garage_client