nxt_http_client 0.3.3 → 0.3.4
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.lock +34 -35
- data/README.md +16 -14
- data/lib/nxt_http_client/version.rb +1 -1
- data/nxt_http_client.gemspec +1 -1
- 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: 89185b814fea114ee2d74dd8e05afd3cf4773cdef8fb908cdf5e954775b4e885
|
4
|
+
data.tar.gz: 2d940e5c42051c09ca776d57901535a7a3d18bf8facb116b742f04a46b91e2ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2dea66682adbebf9800a68cbb3f9962d4b17623bc022163b7765fd1b4a889a78fc610dfc12719d137605e9e3b7c98b254e6f8f5ec80eca947318795b66dd48a2
|
7
|
+
data.tar.gz: 8f04ddb779773c29db1a6f1af0cc73065b4da4e19e7e1a0b43eb5e1c6ec09d94acefb47ca0bdff0880377e2366354a631bc6751adad2ab73c31161108d2fa540
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,73 +1,72 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
nxt_http_client (0.3.
|
5
|
-
activesupport (~> 6.0
|
4
|
+
nxt_http_client (0.3.4)
|
5
|
+
activesupport (~> 6.0)
|
6
6
|
nxt_registry
|
7
7
|
typhoeus
|
8
8
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
|
-
activesupport (6.0
|
12
|
+
activesupport (6.1.0)
|
13
13
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
14
|
-
i18n (>=
|
15
|
-
minitest (
|
16
|
-
tzinfo (~>
|
17
|
-
zeitwerk (~> 2.
|
14
|
+
i18n (>= 1.6, < 2)
|
15
|
+
minitest (>= 5.1)
|
16
|
+
tzinfo (~> 2.0)
|
17
|
+
zeitwerk (~> 2.3)
|
18
18
|
addressable (2.7.0)
|
19
19
|
public_suffix (>= 2.0.2, < 5.0)
|
20
|
-
coderay (1.1.
|
20
|
+
coderay (1.1.3)
|
21
21
|
concurrent-ruby (1.1.7)
|
22
|
-
crack (0.4.
|
23
|
-
|
24
|
-
diff-lcs (1.
|
22
|
+
crack (0.4.5)
|
23
|
+
rexml
|
24
|
+
diff-lcs (1.4.4)
|
25
25
|
ethon (0.12.0)
|
26
26
|
ffi (>= 1.3.0)
|
27
27
|
ffi (1.13.1)
|
28
28
|
hashdiff (1.0.1)
|
29
|
-
i18n (1.8.
|
29
|
+
i18n (1.8.7)
|
30
30
|
concurrent-ruby (~> 1.0)
|
31
31
|
method_source (1.0.0)
|
32
32
|
minitest (5.14.2)
|
33
|
-
nxt_registry (0.3.
|
33
|
+
nxt_registry (0.3.6)
|
34
34
|
activesupport
|
35
|
-
nxt_vcr_harness (0.1.
|
35
|
+
nxt_vcr_harness (0.1.4)
|
36
36
|
rspec (~> 3.0)
|
37
|
-
vcr (~>
|
37
|
+
vcr (~> 6.0)
|
38
38
|
pry (0.13.1)
|
39
39
|
coderay (~> 1.1)
|
40
40
|
method_source (~> 1.0)
|
41
41
|
public_suffix (4.0.6)
|
42
|
-
rake (13.0.
|
43
|
-
redis (4.2.
|
44
|
-
|
45
|
-
|
46
|
-
rspec-
|
47
|
-
rspec-
|
48
|
-
|
49
|
-
|
50
|
-
|
42
|
+
rake (13.0.3)
|
43
|
+
redis (4.2.5)
|
44
|
+
rexml (3.2.4)
|
45
|
+
rspec (3.10.0)
|
46
|
+
rspec-core (~> 3.10.0)
|
47
|
+
rspec-expectations (~> 3.10.0)
|
48
|
+
rspec-mocks (~> 3.10.0)
|
49
|
+
rspec-core (3.10.1)
|
50
|
+
rspec-support (~> 3.10.0)
|
51
|
+
rspec-expectations (3.10.1)
|
51
52
|
diff-lcs (>= 1.2.0, < 2.0)
|
52
|
-
rspec-support (~> 3.
|
53
|
-
rspec-mocks (3.
|
53
|
+
rspec-support (~> 3.10.0)
|
54
|
+
rspec-mocks (3.10.1)
|
54
55
|
diff-lcs (>= 1.2.0, < 2.0)
|
55
|
-
rspec-support (~> 3.
|
56
|
-
rspec-support (3.
|
56
|
+
rspec-support (~> 3.10.0)
|
57
|
+
rspec-support (3.10.1)
|
57
58
|
rspec_junit_formatter (0.4.1)
|
58
59
|
rspec-core (>= 2, < 4, != 2.12.0)
|
59
|
-
safe_yaml (1.0.5)
|
60
|
-
thread_safe (0.3.6)
|
61
60
|
typhoeus (1.4.0)
|
62
61
|
ethon (>= 0.9.0)
|
63
|
-
tzinfo (
|
64
|
-
|
65
|
-
vcr (
|
66
|
-
webmock (3.
|
62
|
+
tzinfo (2.0.4)
|
63
|
+
concurrent-ruby (~> 1.0)
|
64
|
+
vcr (6.0.0)
|
65
|
+
webmock (3.11.0)
|
67
66
|
addressable (>= 2.3.6)
|
68
67
|
crack (>= 0.3.2)
|
69
68
|
hashdiff (>= 0.4.0, < 2.0.0)
|
70
|
-
zeitwerk (2.4.
|
69
|
+
zeitwerk (2.4.2)
|
71
70
|
|
72
71
|
PLATFORMS
|
73
72
|
ruby
|
data/README.md
CHANGED
@@ -26,18 +26,20 @@ Or install it yourself as:
|
|
26
26
|
```ruby
|
27
27
|
class MyClient < NxtHttpClient
|
28
28
|
|
29
|
+
# In your subclasses you probably want to deep_merge options in order to not overwrite options inherited
|
30
|
+
# from the parent class. Of course this will not influence the parent class and you can also reset them
|
31
|
+
# to a new hash here.
|
32
|
+
|
33
|
+
# Also be aware that the result of x_request_id_proc will be hashed into the cache key and thus might cause
|
34
|
+
# your request not to be cached if not used properly
|
35
|
+
|
29
36
|
configure do |config|
|
30
37
|
config.base_url = 'www.example.com'
|
31
|
-
# In your subclasses you probably want to deep_merge options in order to not overwrite options inherited
|
32
|
-
# from the parent class. Of course this will not influence the parent class and you can also reset them
|
33
|
-
# to a new hash here.
|
34
38
|
config.request_options.deep_merge!(
|
35
39
|
headers: { API_KEY: '1993' },
|
36
40
|
method: :get,
|
37
41
|
followlocation: true
|
38
42
|
)
|
39
|
-
# Be aware that the result of x_request_id_proc will be hashed into the cache key and thus might cause
|
40
|
-
# your request not to be cached if not used properly
|
41
43
|
config.x_request_id_proc = -> { ('a'..'z').to_a.shuffle.take(10).join }
|
42
44
|
end
|
43
45
|
|
@@ -48,19 +50,19 @@ class MyClient < NxtHttpClient
|
|
48
50
|
end
|
49
51
|
end
|
50
52
|
|
53
|
+
# Will be called before fire so you can reconfigure your handler before fire
|
51
54
|
before_fire do |client, request, handler|
|
52
|
-
# Will be called before fire
|
53
55
|
handler.on!(200) do |response|
|
54
|
-
#
|
56
|
+
# ...
|
55
57
|
end
|
56
58
|
end
|
57
59
|
|
60
|
+
# Will be called after fire. You probably want to return the result here in order for your code
|
61
|
+
# to be able to access the result from the response handler from before.
|
62
|
+
# In case one of the response handler callbacks raises an error
|
63
|
+
# after fire will has access to it and you may want to reraise the error in that case.
|
64
|
+
|
58
65
|
after_fire do |client, request, response, result, error|
|
59
|
-
# Will be called after fire. You probably want to return the result here in order for your code
|
60
|
-
# to be able to access the result from the response handler from before.
|
61
|
-
|
62
|
-
# In case one of the response handler callbacks raises an error
|
63
|
-
# after fire will has access to it and you may want to reraise the error in that case.
|
64
66
|
if error
|
65
67
|
raise error
|
66
68
|
else
|
@@ -85,10 +87,10 @@ class MyClient < NxtHttpClient
|
|
85
87
|
end
|
86
88
|
end
|
87
89
|
|
90
|
+
# there are also convenience methods for all http verbs (get post patch put delete head)
|
88
91
|
def update
|
89
|
-
# there are also convenience methods for all http verbs (get post patch put delete head)
|
90
92
|
post(params: { my: 'payload' }) do |handler|
|
91
|
-
|
93
|
+
# ...
|
92
94
|
end
|
93
95
|
end
|
94
96
|
end
|
data/nxt_http_client.gemspec
CHANGED
@@ -36,7 +36,7 @@ Gem::Specification.new do |spec|
|
|
36
36
|
spec.require_paths = ['lib']
|
37
37
|
|
38
38
|
spec.add_dependency 'typhoeus'
|
39
|
-
spec.add_dependency 'activesupport', '~> 6.0
|
39
|
+
spec.add_dependency 'activesupport', '~> 6.0'
|
40
40
|
spec.add_dependency 'nxt_registry'
|
41
41
|
|
42
42
|
spec.add_development_dependency 'bundler', '~> 1.17'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nxt_http_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andreas Robecke
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: exe
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2021-01-05 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: typhoeus
|
@@ -33,14 +33,14 @@ dependencies:
|
|
33
33
|
requirements:
|
34
34
|
- - "~>"
|
35
35
|
- !ruby/object:Gem::Version
|
36
|
-
version: 6.0
|
36
|
+
version: '6.0'
|
37
37
|
type: :runtime
|
38
38
|
prerelease: false
|
39
39
|
version_requirements: !ruby/object:Gem::Requirement
|
40
40
|
requirements:
|
41
41
|
- - "~>"
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version: 6.0
|
43
|
+
version: '6.0'
|
44
44
|
- !ruby/object:Gem::Dependency
|
45
45
|
name: nxt_registry
|
46
46
|
requirement: !ruby/object:Gem::Requirement
|