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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b5da65772764a2a9351b9034ae4ffdac4d92b22c5081057c37c4e105c5c1921b
4
- data.tar.gz: 855626eeb47f8c9c75c33482b63f45212b668e793b9cc0307669a1a5d0352d71
3
+ metadata.gz: 13cc776919dbadd0408486e4063dd2f86e80ff57fdc7ef5494b35022689265f9
4
+ data.tar.gz: 0f11121ecebae6db4a5a0c30d0d5a826cf2023364080dcc31523fed23417184b
5
5
  SHA512:
6
- metadata.gz: 475985b1ff666f5accdd9158045e9dad42bd7a912ee1f508397d6f9024b9cd8ce0809abb51367582754afbdcb0adc06eb161ecfcd103893d40b20c1d52dcf621
7
- data.tar.gz: d29e44966fe9f9641ae67688a6a446bb646b1f32a4e2800465a938e606a206ca3aa4a5c471e5554f2a10710f85fb5ce31fb63860e9670cbbf4bdf3938a546e79
6
+ metadata.gz: 4583d9d6ae7c273369ed0a5b2b3dfbd2bdf427bedd548008ef11b36e9daaaa739acc21642aa5bc3496d370eab46142fa0b87fc9fa679857e3c5dcf0a77f7959b
7
+ data.tar.gz: 8128a30f0aacb1909b6f740c930727ee26a2b74c6481544d3ae18690c3466ab94d0e054c769e38ff0100fce3e58d280e5578d14c76f9263fb9158534da6beb7e
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  ## [Releases]
2
2
 
3
+ ## [0.1.2] - 2022-05-15
4
+
5
+ ### Fixed
6
+
7
+ - Missing cluster_status require.
8
+
3
9
  ## [0.1.1] - 2022-05-05
4
10
 
5
11
  ### Fixed
data/Gemfile CHANGED
@@ -5,10 +5,10 @@ source 'https://rubygems.org'
5
5
  # Specify your gem's dependencies in ksql.gemspec
6
6
  gemspec
7
7
 
8
- gem 'byebug', '~> 11'
9
-
10
8
  gem 'rake', '~> 13'
11
9
 
12
10
  gem 'rspec', '~> 3'
13
11
 
14
12
  gem 'rubocop', '~> 1'
13
+
14
+ gem 'simplecov', require: false, group: :test
data/Gemfile.lock CHANGED
@@ -1,22 +1,22 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ksql (0.1.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.2.4)
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://img.shields.io/static/v1?label=Language&message=Ruby&color=red)
3
- ![](https://img.shields.io/static/v1?label=Latest&message=0.1.0.beta.1&color=blue)
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.23.1 | :heavy_check_mark: Supported |
346
- | 0.22.0 | :heavy_check_mark: Supported |
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::TypedRow.handle(result)
70
+ Handlers::TypedList.handle(result)
71
71
  end
72
72
 
73
73
  #
@@ -1,3 +1,29 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class Ksql::Configuration < OpenStruct; end
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, :endpoint, :headers, :method)
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, endpoint, { body: body.to_json, headers: headers.merge(auth_headers) }.compact
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
@@ -2,6 +2,5 @@
2
2
 
3
3
  module Ksql
4
4
  class Error < OpenStruct
5
- # Description here
6
5
  end
7
6
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Ksql
4
4
  module Handlers
5
- class TypedRow
5
+ class TypedList
6
6
  #
7
7
  # Define and instanciate an OpenStruct to fit the typed request response
8
8
  #
data/lib/ksql/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Ksql
4
- VERSION = '0.1.1'
4
+ VERSION = '0.1.2'
5
5
  end
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/typed_row'
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
- def self.config
35
- @config ||= Ksql::Configuration.new
36
- end
37
-
38
- def self.configure
39
- yield(config)
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.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-05 00:00:00.000000000 Z
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/typed_row.rb
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.3.7
105
+ rubygems_version: 3.2.22
106
106
  signing_key:
107
107
  specification_version: 4
108
108
  summary: Kafka ksqlDB Client for Ruby