kosapi_client 0.14.0 → 0.14.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/kosapi_client/entity/link.rb +8 -2
- data/lib/kosapi_client/request_builder_delegator.rb +62 -25
- data/lib/kosapi_client/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: 61088283521ad7523da40145d94966e01b5055e857ebac8770bc706be0ae0a30
|
4
|
+
data.tar.gz: ff3314eb5fbe7a71c00ba832ef849d302f07148d0513dd2a0eecd6f2c358f6d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 04f18b7afdcbbca5814e11dee949b56f8f72f8af4ae6e15c1824383abd9f33dedefab497ec2abdbc1a2f45eb3062bdc26b030cd3cfe15668b829a1d98e7f8c38
|
7
|
+
data.tar.gz: f6809d741d7a69d8b07fd316a9c9253126e3766a9e4d2a3d7b774a19d655bee74dc36f2e2908dad7586123cec1796ad024c919771a778ee4ef720d303710b036
|
@@ -37,8 +37,14 @@ module KOSapiClient
|
|
37
37
|
{ href: link_href, rel: link_rel, title: link_title }
|
38
38
|
end
|
39
39
|
|
40
|
-
|
41
|
-
|
40
|
+
if RUBY_VERSION >= '3.0'
|
41
|
+
def method_missing(method, *args, **kwargs, &block)
|
42
|
+
target.send(method, *args, **kwargs, &block)
|
43
|
+
end
|
44
|
+
else
|
45
|
+
def method_missing(method, *args, &block)
|
46
|
+
target.send(method, *args, &block)
|
47
|
+
end
|
42
48
|
end
|
43
49
|
|
44
50
|
def respond_to_missing?(method_name, include_private = false)
|
@@ -8,14 +8,6 @@ module KOSapiClient
|
|
8
8
|
|
9
9
|
alias :super_method_missing :method_missing
|
10
10
|
|
11
|
-
def method_missing(method, *args, &block)
|
12
|
-
if @response
|
13
|
-
delegate_to_response(method, *args, &block)
|
14
|
-
else
|
15
|
-
delegate_to_builder(method, *args, &block)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
11
|
def respond_to_missing?(method, include_all)
|
20
12
|
if @response
|
21
13
|
@response.respond_to?(method, include_all)
|
@@ -24,27 +16,72 @@ module KOSapiClient
|
|
24
16
|
end
|
25
17
|
end
|
26
18
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
19
|
+
if RUBY_VERSION >= '3.0'
|
20
|
+
def method_missing(method, *args, **kwargs, &block)
|
21
|
+
if @response
|
22
|
+
delegate_to_response(method, *args, **kwargs, &block)
|
23
|
+
else
|
24
|
+
delegate_to_builder(method, *args, **kwargs, &block)
|
25
|
+
end
|
33
26
|
end
|
34
|
-
end
|
35
27
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
if
|
40
|
-
|
28
|
+
private
|
29
|
+
|
30
|
+
def delegate_to_response(method, *args, **kwargs, &block)
|
31
|
+
if @response.respond_to?(method)
|
32
|
+
@response.send(method, *args, **kwargs, &block)
|
41
33
|
else
|
42
|
-
|
34
|
+
super_method_missing(method, *args, **kwargs)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
def delegate_to_builder(method, *args, **kwargs, &block)
|
39
|
+
if @request_builder.respond_to?(method)
|
40
|
+
res = @request_builder.send(method, *args, **kwargs, &block)
|
41
|
+
if res.equal?(@request_builder)
|
42
|
+
self
|
43
|
+
else
|
44
|
+
res
|
45
|
+
end
|
46
|
+
else
|
47
|
+
@request_builder.finalize
|
48
|
+
@response = @request_builder.response
|
49
|
+
delegate_to_response(method, *args, **kwargs, &block)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
else # RUBY_VERSION < '3.0'
|
54
|
+
def method_missing(method, *args, &block)
|
55
|
+
if @response
|
56
|
+
delegate_to_response(method, *args, &block)
|
57
|
+
else
|
58
|
+
delegate_to_builder(method, *args, &block)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
private
|
63
|
+
|
64
|
+
def delegate_to_response(method, *args, &block)
|
65
|
+
if @response.respond_to?(method)
|
66
|
+
@response.send(method, *args, &block)
|
67
|
+
else
|
68
|
+
super_method_missing(method, *args)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
def delegate_to_builder(method, *args, &block)
|
73
|
+
if @request_builder.respond_to?(method)
|
74
|
+
res = @request_builder.send(method, *args, &block)
|
75
|
+
if res.equal?(@request_builder)
|
76
|
+
self
|
77
|
+
else
|
78
|
+
res
|
79
|
+
end
|
80
|
+
else
|
81
|
+
@request_builder.finalize
|
82
|
+
@response = @request_builder.response
|
83
|
+
delegate_to_response(method, *args, &block)
|
43
84
|
end
|
44
|
-
else
|
45
|
-
@request_builder.finalize
|
46
|
-
@response = @request_builder.response
|
47
|
-
delegate_to_response(method, *args, &block)
|
48
85
|
end
|
49
86
|
end
|
50
87
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kosapi_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.14.
|
4
|
+
version: 0.14.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tibor Szolár
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2022-
|
12
|
+
date: 2022-09-14 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|