ksql 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/Gemfile +2 -2
- data/Gemfile.lock +11 -4
- data/README.md +10 -5
- data/lib/ksql/client.rb +1 -1
- data/lib/ksql/configuration.rb +27 -1
- data/lib/ksql/connection/request.rb +2 -2
- data/lib/ksql/error.rb +0 -1
- data/lib/ksql/handlers/{typed_row.rb → typed_list.rb} +1 -1
- data/lib/ksql/version.rb +1 -1
- data/lib/ksql.rb +15 -7
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 13cc776919dbadd0408486e4063dd2f86e80ff57fdc7ef5494b35022689265f9
|
4
|
+
data.tar.gz: 0f11121ecebae6db4a5a0c30d0d5a826cf2023364080dcc31523fed23417184b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4583d9d6ae7c273369ed0a5b2b3dfbd2bdf427bedd548008ef11b36e9daaaa739acc21642aa5bc3496d370eab46142fa0b87fc9fa679857e3c5dcf0a77f7959b
|
7
|
+
data.tar.gz: 8128a30f0aacb1909b6f740c930727ee26a2b74c6481544d3ae18690c3466ab94d0e054c769e38ff0100fce3e58d280e5578d14c76f9263fb9158534da6beb7e
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,22 +1,22 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
ksql (0.1.
|
4
|
+
ksql (0.1.2)
|
5
5
|
activesupport (>= 5)
|
6
6
|
net-http2 (~> 0)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
activesupport (7.0.
|
11
|
+
activesupport (7.0.3)
|
12
12
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
13
13
|
i18n (>= 1.6, < 2)
|
14
14
|
minitest (>= 5.1)
|
15
15
|
tzinfo (~> 2.0)
|
16
16
|
ast (2.4.2)
|
17
|
-
byebug (11.1.3)
|
18
17
|
concurrent-ruby (1.1.10)
|
19
18
|
diff-lcs (1.5.0)
|
19
|
+
docile (1.4.0)
|
20
20
|
http-2 (0.11.0)
|
21
21
|
i18n (1.10.0)
|
22
22
|
concurrent-ruby (~> 1.0)
|
@@ -55,6 +55,12 @@ GEM
|
|
55
55
|
rubocop-ast (1.15.0)
|
56
56
|
parser (>= 3.0.1.1)
|
57
57
|
ruby-progressbar (1.11.0)
|
58
|
+
simplecov (0.21.2)
|
59
|
+
docile (~> 1.1)
|
60
|
+
simplecov-html (~> 0.11)
|
61
|
+
simplecov_json_formatter (~> 0.1)
|
62
|
+
simplecov-html (0.12.3)
|
63
|
+
simplecov_json_formatter (0.1.4)
|
58
64
|
tzinfo (2.0.4)
|
59
65
|
concurrent-ruby (~> 1.0)
|
60
66
|
unicode-display_width (2.1.0)
|
@@ -62,13 +68,14 @@ GEM
|
|
62
68
|
PLATFORMS
|
63
69
|
arm64-darwin-21
|
64
70
|
x86_64-darwin-20
|
71
|
+
x86_64-linux
|
65
72
|
|
66
73
|
DEPENDENCIES
|
67
|
-
byebug (~> 11)
|
68
74
|
ksql!
|
69
75
|
rake (~> 13)
|
70
76
|
rspec (~> 3)
|
71
77
|
rubocop (~> 1)
|
78
|
+
simplecov
|
72
79
|
|
73
80
|
BUNDLED WITH
|
74
81
|
2.3.9
|
data/README.md
CHANGED
@@ -1,9 +1,11 @@
|
|
1
1
|
## <img src="https://user-images.githubusercontent.com/50866745/156314925-b823bfe2-a9d4-4b83-8376-29a6a659b57f.png" width="48"> ksqlDB Client <!-- omit in toc -->
|
2
|
-
![](https://
|
3
|
-
![](https://img.shields.io/static/v1?label=
|
2
|
+
[![CircleCI](https://circleci.com/gh/LapoElisacci/Ksql/tree/main.svg?style=svg)](https://circleci.com/gh/LapoElisacci/Ksql/tree/main)
|
3
|
+
![](https://img.shields.io/static/v1?label=Coverage&message=98.78%&color=brightgreen)
|
4
|
+
![](https://img.shields.io/static/v1?label=Latest&message=0.1.1&color=blue)
|
5
|
+
![](https://ruby-gem-downloads-badge.herokuapp.com/ksql?type=total&color=blue)
|
4
6
|
![StandWithUkraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/badges/StandWithUkraine.svg)
|
5
7
|
|
6
|
-
KSQL is a [ksqlDB](https://ksqldb.io/) Ruby client that focuses on ease of use. Supports all recent ksqlDB features and does not have any heavyweight dependencies.
|
8
|
+
**KSQL** is a [ksqlDB](https://ksqldb.io/) Ruby client that focuses on ease of use. Supports all recent ksqlDB features and does not have any heavyweight dependencies.
|
7
9
|
|
8
10
|
## What is ksqlDB? <!-- omit in toc -->
|
9
11
|
|
@@ -342,8 +344,10 @@ Ksql::Client.ksql('DROP STREAM IF EXISTS riderLocations;')
|
|
342
344
|
|
343
345
|
| Version | |
|
344
346
|
| ------ | -- |
|
345
|
-
| 0.
|
346
|
-
| 0.
|
347
|
+
| 0.25 | :heavy_check_mark: Supported |
|
348
|
+
| 0.24 | :heavy_check_mark: Supported |
|
349
|
+
| 0.23 | :heavy_check_mark: Supported |
|
350
|
+
| 0.22 | :heavy_check_mark: Supported |
|
347
351
|
| Older | :x: Untested |
|
348
352
|
|
349
353
|
## Known issues
|
@@ -368,3 +372,4 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/LapoEl
|
|
368
372
|
## License
|
369
373
|
|
370
374
|
[![Licence](https://img.shields.io/github/license/Ileriayo/markdown-badges?style=for-the-badge)](https://opensource.org/licenses/MIT)
|
375
|
+
|
data/lib/ksql/client.rb
CHANGED
@@ -67,7 +67,7 @@ module Ksql
|
|
67
67
|
def ksql(ksql, command_sequence_number: nil, headers: {}, session_variables: {}, streams_properties: {})
|
68
68
|
request = Api::Ksql.build(ksql, command_sequence_number: command_sequence_number, headers: headers, session_variables: session_variables, streams_properties: streams_properties)
|
69
69
|
result = Connection::Client.call_sync(request)
|
70
|
-
Handlers::
|
70
|
+
Handlers::TypedList.handle(result)
|
71
71
|
end
|
72
72
|
|
73
73
|
#
|
data/lib/ksql/configuration.rb
CHANGED
@@ -1,3 +1,29 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
3
|
+
module Ksql
|
4
|
+
class ConfigurationError < StandardError; end
|
5
|
+
|
6
|
+
#
|
7
|
+
# Ksql configuration
|
8
|
+
#
|
9
|
+
class Configuration
|
10
|
+
REQUIRED_ATTRS = %i[host].freeze
|
11
|
+
OPTIONAL_ATTRS = %i[auth].freeze
|
12
|
+
|
13
|
+
attr_accessor(*REQUIRED_ATTRS + OPTIONAL_ATTRS)
|
14
|
+
|
15
|
+
#
|
16
|
+
# Ensure required attributes are properly configured
|
17
|
+
#
|
18
|
+
# @return [Boolean] true
|
19
|
+
#
|
20
|
+
def validate
|
21
|
+
REQUIRED_ATTRS.each do |attribute|
|
22
|
+
value = instance_variable_get("@#{attribute}")
|
23
|
+
raise ConfigurationError, "Ksql required #{attribute} missing!" if value.nil? || value.strip.empty?
|
24
|
+
end
|
25
|
+
|
26
|
+
true
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -2,14 +2,14 @@
|
|
2
2
|
|
3
3
|
module Ksql
|
4
4
|
module Connection
|
5
|
-
class Request < Struct.new(:body, :
|
5
|
+
class Request < Struct.new(:body, :path, :headers, :method)
|
6
6
|
#
|
7
7
|
# Returns the request params
|
8
8
|
#
|
9
9
|
# @return [Array] Request params
|
10
10
|
#
|
11
11
|
def to_params
|
12
|
-
return method,
|
12
|
+
return method, path, { body: body.to_json, headers: headers.merge(auth_headers) }.compact
|
13
13
|
end
|
14
14
|
|
15
15
|
private
|
data/lib/ksql/error.rb
CHANGED
data/lib/ksql/version.rb
CHANGED
data/lib/ksql.rb
CHANGED
@@ -6,6 +6,7 @@ require 'json'
|
|
6
6
|
require 'ostruct'
|
7
7
|
|
8
8
|
require_relative 'ksql/api/close_query'
|
9
|
+
require_relative 'ksql/api/cluster_status'
|
9
10
|
require_relative 'ksql/api/health_check'
|
10
11
|
require_relative 'ksql/api/info'
|
11
12
|
require_relative 'ksql/api/ksql'
|
@@ -16,7 +17,7 @@ require_relative 'ksql/api/terminate'
|
|
16
17
|
require_relative 'ksql/handlers/collection'
|
17
18
|
require_relative 'ksql/handlers/raw'
|
18
19
|
require_relative 'ksql/handlers/stream'
|
19
|
-
require_relative 'ksql/handlers/
|
20
|
+
require_relative 'ksql/handlers/typed_list'
|
20
21
|
|
21
22
|
require_relative 'ksql/connection/client'
|
22
23
|
require_relative 'ksql/connection/request'
|
@@ -31,11 +32,18 @@ require_relative 'ksql/stream'
|
|
31
32
|
require_relative 'ksql/version'
|
32
33
|
|
33
34
|
module Ksql
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
35
|
+
class << self
|
36
|
+
attr_accessor :config
|
37
|
+
|
38
|
+
#
|
39
|
+
# Configure Ksql
|
40
|
+
#
|
41
|
+
# @return [Boolean] true
|
42
|
+
#
|
43
|
+
def configure
|
44
|
+
self.config = Ksql::Configuration.new
|
45
|
+
yield(config)
|
46
|
+
config.validate
|
47
|
+
end
|
40
48
|
end
|
41
49
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ksql
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lapo Elisacci
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-05-
|
11
|
+
date: 2022-05-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -76,7 +76,7 @@ files:
|
|
76
76
|
- lib/ksql/handlers/collection.rb
|
77
77
|
- lib/ksql/handlers/raw.rb
|
78
78
|
- lib/ksql/handlers/stream.rb
|
79
|
-
- lib/ksql/handlers/
|
79
|
+
- lib/ksql/handlers/typed_list.rb
|
80
80
|
- lib/ksql/stream.rb
|
81
81
|
- lib/ksql/version.rb
|
82
82
|
- sig/ksql.rbs
|
@@ -102,7 +102,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
requirements: []
|
105
|
-
rubygems_version: 3.
|
105
|
+
rubygems_version: 3.2.22
|
106
106
|
signing_key:
|
107
107
|
specification_version: 4
|
108
108
|
summary: Kafka ksqlDB Client for Ruby
|