lontara_utilities 3.0.2 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +0 -1
- data/Gemfile.lock +40 -31
- data/build.sh +7 -0
- data/lib/lontara_utilities/http_client/request.rb +8 -12
- data/lib/lontara_utilities/http_client.rb +9 -4
- data/lib/lontara_utilities/version.rb +1 -1
- data/lontara-utilities.gemspec +1 -0
- metadata +18 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4756cd27d3f55e0d430ed095bc5d343fca09bc93d76e20437c179c711fccd2e0
|
4
|
+
data.tar.gz: 675d3676af0f25881c2ca615160ba93936db0336e3f239eca3b6d8572e3c9909
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0b2409ecc4c054822ce5756f2d020bf8d50238fbb82e6b5a8d349c11fd170dd36ac60b44ea5627e296e0b4d400c0ecbbe536832fb4d51215f3ecc898d8ec06ae
|
7
|
+
data.tar.gz: 46bd2babae345b0f71cb7874a7bb3c5b4505558dfd5ac48f12e0698c543e6ce166c3cb1c77a26295065440fd7a4dc27ae402ef2986528151045d8360f34b5df5
|
data/.gitignore
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
lontara_utilities (3.
|
4
|
+
lontara_utilities (3.1.0)
|
5
5
|
bunny (~> 2.20)
|
6
|
-
connection_pool (~> 2.
|
6
|
+
connection_pool (~> 2.4)
|
7
7
|
faraday (~> 2.7)
|
8
|
+
faraday-net_http_persistent (~> 2.0)
|
8
9
|
json (~> 2.6)
|
9
10
|
securerandom (~> 0.2)
|
10
11
|
uri (~> 0.12)
|
@@ -12,47 +13,55 @@ PATH
|
|
12
13
|
GEM
|
13
14
|
remote: https://rubygems.org/
|
14
15
|
specs:
|
15
|
-
addressable (2.8.
|
16
|
+
addressable (2.8.6)
|
16
17
|
public_suffix (>= 2.0.2, < 6.0)
|
17
18
|
amq-protocol (2.3.2)
|
18
|
-
|
19
|
+
bigdecimal (3.1.6)
|
20
|
+
bunny (2.22.0)
|
19
21
|
amq-protocol (~> 2.3, >= 2.3.1)
|
20
22
|
sorted_set (~> 1, >= 1.0.2)
|
21
23
|
byebug (11.1.3)
|
22
|
-
connection_pool (2.4.
|
23
|
-
crack (0.
|
24
|
+
connection_pool (2.4.1)
|
25
|
+
crack (1.0.0)
|
26
|
+
bigdecimal
|
24
27
|
rexml
|
25
|
-
diff-lcs (1.5.
|
26
|
-
faraday (2.
|
27
|
-
faraday-net_http (>= 2.0, < 3.
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
28
|
+
diff-lcs (1.5.1)
|
29
|
+
faraday (2.9.0)
|
30
|
+
faraday-net_http (>= 2.0, < 3.2)
|
31
|
+
faraday-net_http (3.1.0)
|
32
|
+
net-http
|
33
|
+
faraday-net_http_persistent (2.1.0)
|
34
|
+
faraday (~> 2.5)
|
35
|
+
net-http-persistent (~> 4.0)
|
36
|
+
hashdiff (1.1.0)
|
37
|
+
json (2.7.1)
|
38
|
+
net-http (0.4.1)
|
39
|
+
uri
|
40
|
+
net-http-persistent (4.0.2)
|
41
|
+
connection_pool (~> 2.2)
|
42
|
+
public_suffix (5.0.4)
|
33
43
|
rbtree (0.4.6)
|
34
|
-
rexml (3.2.
|
35
|
-
rspec (3.
|
36
|
-
rspec-core (~> 3.
|
37
|
-
rspec-expectations (~> 3.
|
38
|
-
rspec-mocks (~> 3.
|
39
|
-
rspec-core (3.
|
40
|
-
rspec-support (~> 3.
|
41
|
-
rspec-expectations (3.
|
44
|
+
rexml (3.2.6)
|
45
|
+
rspec (3.13.0)
|
46
|
+
rspec-core (~> 3.13.0)
|
47
|
+
rspec-expectations (~> 3.13.0)
|
48
|
+
rspec-mocks (~> 3.13.0)
|
49
|
+
rspec-core (3.13.0)
|
50
|
+
rspec-support (~> 3.13.0)
|
51
|
+
rspec-expectations (3.13.0)
|
42
52
|
diff-lcs (>= 1.2.0, < 2.0)
|
43
|
-
rspec-support (~> 3.
|
44
|
-
rspec-mocks (3.
|
53
|
+
rspec-support (~> 3.13.0)
|
54
|
+
rspec-mocks (3.13.0)
|
45
55
|
diff-lcs (>= 1.2.0, < 2.0)
|
46
|
-
rspec-support (~> 3.
|
47
|
-
rspec-support (3.
|
48
|
-
|
49
|
-
|
50
|
-
set (1.0.3)
|
56
|
+
rspec-support (~> 3.13.0)
|
57
|
+
rspec-support (3.13.0)
|
58
|
+
securerandom (0.3.1)
|
59
|
+
set (1.1.0)
|
51
60
|
sorted_set (1.0.3)
|
52
61
|
rbtree
|
53
62
|
set (~> 1.0)
|
54
|
-
uri (0.
|
55
|
-
webmock (3.
|
63
|
+
uri (0.13.0)
|
64
|
+
webmock (3.21.2)
|
56
65
|
addressable (>= 2.8.0)
|
57
66
|
crack (>= 0.3.2)
|
58
67
|
hashdiff (>= 0.4.0, < 2.0.0)
|
data/build.sh
ADDED
@@ -25,18 +25,14 @@ module LontaraUtilities
|
|
25
25
|
attr_reader :method, :url, :headers, :body, :params, :timeout
|
26
26
|
|
27
27
|
def call
|
28
|
-
connection.
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
def connection
|
37
|
-
Faraday.new do |faraday|
|
38
|
-
faraday.headers = headers
|
39
|
-
faraday.adapter Faraday.default_adapter
|
28
|
+
HTTPClient.connection.with do |conn|
|
29
|
+
conn.send(method, url) do |req|
|
30
|
+
req.headers = headers
|
31
|
+
req.body = parsed_body if body
|
32
|
+
req.params = params if params
|
33
|
+
req.options.timeout = timeout
|
34
|
+
req.options.open_timeout = timeout
|
35
|
+
end
|
40
36
|
end
|
41
37
|
end
|
42
38
|
|
@@ -3,6 +3,8 @@
|
|
3
3
|
require 'json'
|
4
4
|
require 'uri'
|
5
5
|
require 'faraday'
|
6
|
+
require 'faraday/net_http_persistent'
|
7
|
+
require 'connection_pool'
|
6
8
|
|
7
9
|
require_relative 'git'
|
8
10
|
require_relative 'http_client/body_parser'
|
@@ -44,14 +46,17 @@ module LontaraUtilities
|
|
44
46
|
# JSON.parse(request.body)
|
45
47
|
#
|
46
48
|
module HTTPClient
|
47
|
-
def self.
|
48
|
-
|
49
|
+
def self.connection
|
50
|
+
@connection ||= ::ConnectionPool::Wrapper.new(size: 5, timeout: 5) do
|
51
|
+
Faraday.new do |faraday|
|
52
|
+
faraday.adapter :net_http_persistent
|
53
|
+
end
|
54
|
+
end
|
49
55
|
end
|
50
56
|
|
51
|
-
# Use predifined method to make HTTP request.
|
52
57
|
%i[get post put delete patch].each do |method|
|
53
58
|
define_singleton_method(method) do |url:, **options|
|
54
|
-
Request.new(method, url
|
59
|
+
Request.new(method, url: url, **options).perform
|
55
60
|
end
|
56
61
|
end
|
57
62
|
end
|
data/lontara-utilities.gemspec
CHANGED
@@ -26,6 +26,7 @@ Gem::Specification.new do |spec|
|
|
26
26
|
spec.add_dependency 'bunny', '~> 2.20'
|
27
27
|
spec.add_dependency 'connection_pool', '~> 2.4'
|
28
28
|
spec.add_dependency 'faraday', '~> 2.7'
|
29
|
+
spec.add_dependency 'faraday-net_http_persistent', '~> 2.0'
|
29
30
|
spec.add_dependency 'json', '~> 2.6'
|
30
31
|
spec.add_dependency 'securerandom', '~> 0.2'
|
31
32
|
spec.add_dependency 'uri', '~> 0.12'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lontara_utilities
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0
|
4
|
+
version: 3.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Abdul Hakim Ghaniy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-02-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bunny
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '2.7'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: faraday-net_http_persistent
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '2.0'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '2.0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: json
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -152,6 +166,7 @@ files:
|
|
152
166
|
- Gemfile.lock
|
153
167
|
- LICENSE
|
154
168
|
- README.md
|
169
|
+
- build.sh
|
155
170
|
- lib/lontara.rb
|
156
171
|
- lib/lontara_utilities.rb
|
157
172
|
- lib/lontara_utilities/base_error.rb
|
@@ -194,7 +209,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
194
209
|
- !ruby/object:Gem::Version
|
195
210
|
version: '0'
|
196
211
|
requirements: []
|
197
|
-
rubygems_version: 3.
|
212
|
+
rubygems_version: 3.4.21
|
198
213
|
signing_key:
|
199
214
|
specification_version: 4
|
200
215
|
summary: Lontara Utilities provided by Lontara.app
|