kapellmeister 0.5.2 → 0.6.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 +4 -4
- data/lib/generators/kapellmeister/templates/lib/third_party/configuration.rb.tt +3 -1
- data/lib/generators/kapellmeister/templates/lib/third_party.rb.tt +1 -1
- data/lib/kapellmeister/base.rb +2 -2
- data/lib/kapellmeister/dispatcher.rb +8 -4
- data/lib/kapellmeister/responder.rb +3 -3
- data/lib/kapellmeister/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 409792ce404710854c377a9d87c4b36e03d86b03e0370459bc6b99dfacfec516
|
4
|
+
data.tar.gz: 6cee24733a1acfc189bbdb34b2f3b3d28857402ba926cc77ce58f2d4be853164
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d67914af1df363b0e89cfd7a71f48419da7db47350f307c7e0c251c0a4e3252446e10c1a33769e30c6bcf7c4b4f10c09d75a96608052aff68a7473e31ca74a8
|
7
|
+
data.tar.gz: 373bac9c6d765bfb2a0350bb21dcfff117839e76b82b7a09dd3dc7ef48c77bba8090dc311c936c9e956b5cce3b0616a5f0ed00c2a98679ac34ec93c5bacee425
|
@@ -9,7 +9,9 @@ class <%= class_name %>::Configuration
|
|
9
9
|
def url
|
10
10
|
raise "No given host to #{self.class.name}" unless host
|
11
11
|
|
12
|
-
https =
|
12
|
+
https = true
|
13
|
+
https = ssl unless ssl.nil?
|
14
|
+
https = <%= class_name %>.ssl unless <%= class_name %>.ssl.nil?
|
13
15
|
|
14
16
|
"URI::HTTP#{https.to_b ? 'S' : ''}".constantize.build(host:, path: [path, version].join('/'))
|
15
17
|
end
|
data/lib/kapellmeister/base.rb
CHANGED
@@ -28,8 +28,8 @@ module Kapellmeister::Base
|
|
28
28
|
def self.routes_scheme_parse(path)
|
29
29
|
template = ERB.new(File.read(path)).result
|
30
30
|
YAML.safe_load(template, aliases: true, permitted_classes: [Symbol, Date, Time]).deep_symbolize_keys
|
31
|
-
rescue Errno::ENOENT
|
32
|
-
warn
|
31
|
+
rescue Errno::ENOENT
|
32
|
+
warn 'No such file or directory', path
|
33
33
|
{}
|
34
34
|
end
|
35
35
|
end
|
@@ -5,19 +5,19 @@ class Kapellmeister::Dispatcher
|
|
5
5
|
super
|
6
6
|
base.extend(Kapellmeister::RequestsExtension)
|
7
7
|
|
8
|
-
delegate :report, :
|
8
|
+
delegate :report, :logger, to: base.module_parent
|
9
9
|
end
|
10
10
|
|
11
11
|
FailedResponse = Struct.new(:success?, :response, :payload)
|
12
12
|
|
13
|
-
def connection_by(method_name, path, data = {}
|
13
|
+
def connection_by(method_name, path, data = {})
|
14
14
|
additional_headers = data.delete(:headers) || {}
|
15
15
|
requests_data = data.delete(:request) || {}
|
16
16
|
|
17
|
-
generated_connection = connection(additional_headers
|
17
|
+
generated_connection = connection(additional_headers: additional_headers, requests_data: requests_data) # rubocop:disable Style/HashSyntax (for support ruby 2.4+)
|
18
18
|
|
19
19
|
process generated_connection.run_request(method_name.downcase.to_sym, path, data.to_json, additional_headers)
|
20
|
-
rescue
|
20
|
+
rescue NameError, RuntimeError
|
21
21
|
raise "Library can't process method #{method_name} yet"
|
22
22
|
rescue Faraday::ConnectionFailed, Faraday::TimeoutError => e
|
23
23
|
failed_response(details: e.message)
|
@@ -31,6 +31,10 @@ class Kapellmeister::Dispatcher
|
|
31
31
|
{}
|
32
32
|
end
|
33
33
|
|
34
|
+
def configuration
|
35
|
+
self.class.module_parent.configuration
|
36
|
+
end
|
37
|
+
|
34
38
|
private
|
35
39
|
|
36
40
|
def connection(additional_headers:, requests_data:)
|
@@ -6,15 +6,15 @@ class Kapellmeister::Responder
|
|
6
6
|
|
7
7
|
def initialize(response, **args)
|
8
8
|
@response = response
|
9
|
-
@payload = args
|
9
|
+
@payload = args.merge(status: status) # rubocop:disable Style/HashSyntax (for support ruby 2.4+)
|
10
10
|
end
|
11
11
|
|
12
12
|
def result
|
13
13
|
error = !/2\d{2}/.match?(status.to_s)
|
14
14
|
|
15
|
-
Result.new(!error, parsed_body,
|
15
|
+
Result.new(!error, parsed_body, payload)
|
16
16
|
rescue JSON::ParserError => e
|
17
|
-
Result.new(false, e)
|
17
|
+
Result.new(false, { message: e.message }, payload)
|
18
18
|
end
|
19
19
|
|
20
20
|
private
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kapellmeister
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- DarkWater
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-05
|
11
|
+
date: 2022-08-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-schema
|