kapellmeister 0.9.9.rc3 → 0.10.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/README.md +4 -4
- data/kapellmeister.gemspec +1 -0
- data/lib/kapellmeister/dispatcher.rb +11 -4
- data/lib/kapellmeister/version.rb +1 -1
- metadata +18 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 500fb7ca6f037a311771dca81143327413fef4c42398361abb055feedea7df0d
|
4
|
+
data.tar.gz: 04a6715c37cfda625638dad0af924801141aad1b6f72e52d81276bd76c582757
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6d11daa3bbcba9ccac050f84c4a6de6e723b61c29d1e1b6de262cd291aca28cca2a4c8d03474961eb5bc5a4d68423d35522f7f87ed675e7264359cdd4162c38b
|
7
|
+
data.tar.gz: e0bbefe760e600fbc2d52ed49460416874053dc8cd59e2a01f82bf31d988b66330291263a75754c922c688295f2faf2da6082bbd7f7274376b36e47184beb278
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -4,9 +4,9 @@
|
|
4
4
|
## Использование
|
5
5
|
|
6
6
|
Добавьте kapellmeister в свой Gemfile:
|
7
|
-
На данный момент последняя версия 0.
|
7
|
+
На данный момент последняя версия 0.10.0 (Проект находится в стадии тестирования работоспособности, beta-test)
|
8
8
|
```ruby
|
9
|
-
gem 'kapellmeister', '~> 0.
|
9
|
+
gem 'kapellmeister', '~> 0.10.0'
|
10
10
|
```
|
11
11
|
|
12
12
|
### Добавьте новую конфигурацию для стороннего API:
|
@@ -137,9 +137,9 @@ This template-service allows you to define http requests to a third party throug
|
|
137
137
|
## Usage
|
138
138
|
|
139
139
|
Add kapellmeister to your Gemfile:
|
140
|
-
At the moment, the latest version is 0.
|
140
|
+
At the moment, the latest version is 0.10.0 (The project is in the stage of performance testing, beta-test)
|
141
141
|
```ruby
|
142
|
-
gem 'kapellmeister', '~> 0.
|
142
|
+
gem 'kapellmeister', '~> 0.10.0'
|
143
143
|
```
|
144
144
|
|
145
145
|
### Add a new configuration for the third-party API:
|
data/kapellmeister.gemspec
CHANGED
@@ -29,6 +29,7 @@ Gem::Specification.new do |gem|
|
|
29
29
|
gem.add_dependency 'faraday', '~> 2.10'
|
30
30
|
gem.add_dependency 'faraday-cookie_jar', '~> 0.0.7'
|
31
31
|
gem.add_dependency 'faraday-follow_redirects', '~> 0.3.0'
|
32
|
+
gem.add_dependency 'faraday-multipart', '~> 1.0.0'
|
32
33
|
gem.add_dependency 'faraday-typhoeus', '~> 1.1.0'
|
33
34
|
|
34
35
|
gem.add_development_dependency 'bundler', '~> 2.0', '>= 2.0.2'
|
@@ -1,4 +1,6 @@
|
|
1
1
|
require 'faraday/follow_redirects'
|
2
|
+
require 'faraday/typhoeus'
|
3
|
+
require 'faraday/multipart'
|
2
4
|
require_relative 'requests_extension'
|
3
5
|
|
4
6
|
class Kapellmeister::Dispatcher
|
@@ -40,6 +42,7 @@ class Kapellmeister::Dispatcher
|
|
40
42
|
additional_headers = data.delete(:headers) || {}
|
41
43
|
requests_data = data.delete(:request) || {}
|
42
44
|
data_json = data.blank? ? '' : data.to_json
|
45
|
+
additional_headers['Content-Length'] = requests_data.merge(data).to_s.bytesize unless get?(method_name)
|
43
46
|
|
44
47
|
generated_connection = connection(additional_headers: additional_headers, requests_data: requests_data) # rubocop:disable Style/HashSyntax (for support ruby 2.4+)
|
45
48
|
|
@@ -53,9 +56,9 @@ class Kapellmeister::Dispatcher
|
|
53
56
|
end
|
54
57
|
|
55
58
|
def connection(additional_headers:, requests_data:)
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
+
request = requests_generate(**requests_data)
|
60
|
+
headers = headers_generate(**additional_headers)
|
61
|
+
@connection ||= ::Faraday.new(url: configuration.url, headers: headers, request: request) do |faraday| # rubocop:disable Style/HashSyntax (for support ruby 2.4+)
|
59
62
|
faraday.request :json, content_type: 'application/json; charset=utf-8'
|
60
63
|
faraday.request :multipart
|
61
64
|
faraday.response :logger, logger
|
@@ -95,7 +98,7 @@ class Kapellmeister::Dispatcher
|
|
95
98
|
url_part.ascii_only? ? url_part : CGI.escape(url_part)
|
96
99
|
end.join('/')
|
97
100
|
|
98
|
-
url = url_repacking(url, data) if method_name
|
101
|
+
url = url_repacking(url, data) if get?(method_name)
|
99
102
|
|
100
103
|
return url if query_params.blank?
|
101
104
|
|
@@ -109,6 +112,10 @@ class Kapellmeister::Dispatcher
|
|
109
112
|
uri.to_s
|
110
113
|
end
|
111
114
|
|
115
|
+
def get?(method_name)
|
116
|
+
method_name.downcase.to_sym.eql?(:get)
|
117
|
+
end
|
118
|
+
|
112
119
|
def failed_response(**args)
|
113
120
|
FailedResponse.new(false, { message: "#{self.class} no connection" }, { status: 555, **args })
|
114
121
|
end
|
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.10.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- DarkWater
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-11-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dry-schema
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 0.3.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: faraday-multipart
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 1.0.0
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 1.0.0
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: faraday-typhoeus
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -217,9 +231,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
217
231
|
version: 2.4.2
|
218
232
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
219
233
|
requirements:
|
220
|
-
- - "
|
234
|
+
- - ">="
|
221
235
|
- !ruby/object:Gem::Version
|
222
|
-
version:
|
236
|
+
version: '0'
|
223
237
|
requirements: []
|
224
238
|
rubygems_version: 3.3.7
|
225
239
|
signing_key:
|