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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3ddc958339b1941f96107542a7c50bcbdf3f9dc869362ff4a68190ea1b9fd7c0
4
- data.tar.gz: 7807d6b087afd5b02e0f8e7516fe5e0822efac8f31df52b2656a67bbff6a133c
3
+ metadata.gz: 61088283521ad7523da40145d94966e01b5055e857ebac8770bc706be0ae0a30
4
+ data.tar.gz: ff3314eb5fbe7a71c00ba832ef849d302f07148d0513dd2a0eecd6f2c358f6d8
5
5
  SHA512:
6
- metadata.gz: 2ad6c535c9bcf9a85138047fabbef4e129c8377c9b9b10277a542d79ab02ee1102c80cc03d4824325795fcd20e7243c319b0c31b6f13022d0de1e43c917b199e
7
- data.tar.gz: 549b833216a3d5f0b8bd8bbf2dfe96581d771abe2eff8ce9c8634f627e678cae653d0d01de7f7d3e3e5d23674e3211a57a0bf597426c59097e195ad6d15d5034
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
- def method_missing(method, *args, &block)
41
- target.send(method, *args, &block)
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
- private
28
- def delegate_to_response(method, *args, &block)
29
- if @response.respond_to?(method)
30
- @response.send(method, *args, &block)
31
- else
32
- super_method_missing(method, *args)
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
- def delegate_to_builder(method, *args, &block)
37
- if @request_builder.respond_to?(method)
38
- res = @request_builder.send(method, *args, &block)
39
- if res.equal?(@request_builder)
40
- self
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
- res
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
 
@@ -1,3 +1,3 @@
1
1
  module KOSapiClient
2
- VERSION = '0.14.0'
2
+ VERSION = '0.14.1'
3
3
  end
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.0
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-07-08 00:00:00.000000000 Z
12
+ date: 2022-09-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler