client-api-builder 0.4.1 → 0.5.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/client-api-builder.gemspec +1 -1
- data/lib/client_api_builder/nested_router.rb +0 -76
- data/lib/client_api_builder/router.rb +4 -4
- 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: 7ba2a10bca8dbdf440a037007da9858446a7c1b165575d49510e7ed37d9d53d6
|
4
|
+
data.tar.gz: aeb66f9fbfeeefb4d946975641dba14002706ac07117dcaca5d41d89dbf10a7d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a346879ca1a8dac4f6c849c68fb3c2553bdb298e490a0c5da6f38768d0a18f858d08c21ddbf119bff2975f5023d38592711292240437c721e111caa7023ec5bb
|
7
|
+
data.tar.gz: 4f0faf034b9749c59cdb2c1d79adf7109e1bcd8ed1b85a1ffa189622a793d34d0f26df0c4e3a5f674700831c28f1ded0f40c8f9765657cc457e9da10b4f374e1
|
data/client-api-builder.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = 'client-api-builder'
|
5
|
-
s.version = '0.
|
5
|
+
s.version = '0.5.5'
|
6
6
|
s.licenses = ['MIT']
|
7
7
|
s.summary = 'Utility for creating API clients through configuration'
|
8
8
|
s.description = 'Create API clients through configuration with complete transparency'
|
@@ -20,88 +20,12 @@ module ClientApiBuilder
|
|
20
20
|
"\#{root_router.#{var}\}"
|
21
21
|
end
|
22
22
|
|
23
|
-
def request(**options, &block)
|
24
|
-
root_router.request(**options, &block)
|
25
|
-
end
|
26
|
-
|
27
|
-
def stream(**options, &block)
|
28
|
-
root_router.stream(**options, &block)
|
29
|
-
end
|
30
|
-
|
31
|
-
def stream_to_io(**options, &block)
|
32
|
-
root_router.stream_to_io(**options, &block)
|
33
|
-
end
|
34
|
-
|
35
|
-
def stream_to_file(**options, &block)
|
36
|
-
root_router.stream_to_file(**options, &block)
|
37
|
-
end
|
38
|
-
|
39
23
|
def base_url
|
40
24
|
self.class.base_url || root_router.base_url
|
41
25
|
end
|
42
26
|
|
43
|
-
def build_headers(options)
|
44
|
-
headers = nested_router_options[:ignore_headers] ? {} : root_router.build_headers(options)
|
45
|
-
|
46
|
-
add_header_proc = proc do |name, value|
|
47
|
-
headers[name] =
|
48
|
-
if value.is_a?(Proc)
|
49
|
-
root_router.instance_eval(&value)
|
50
|
-
elsif value.is_a?(Symbol)
|
51
|
-
root_router.send(value)
|
52
|
-
else
|
53
|
-
value
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
self.class.default_headers.each(&add_header_proc)
|
58
|
-
|
59
|
-
headers
|
60
|
-
end
|
61
|
-
|
62
|
-
def build_connection_options(options)
|
63
|
-
root_router.build_connection_options(options)
|
64
|
-
end
|
65
|
-
|
66
|
-
def build_query(query, options)
|
67
|
-
return nil if query.nil? && root_router.class.default_query_params.empty? && self.class.default_query_params.empty?
|
68
|
-
return nil if nested_router_options[:ignore_query] && query.nil? && self.class.default_query_params.empty?
|
69
|
-
|
70
|
-
query_params = {}
|
71
|
-
|
72
|
-
add_query_param_proc = proc do |name, value|
|
73
|
-
query_params[name] =
|
74
|
-
if value.is_a?(Proc)
|
75
|
-
root_router.instance_eval(&value)
|
76
|
-
elsif value.is_a?(Symbol)
|
77
|
-
root_router.send(value)
|
78
|
-
else
|
79
|
-
value
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
root_router.class.default_query_params.each(&add_query_param_proc)
|
84
|
-
self.class.default_query_params.each(&add_query_param_proc)
|
85
|
-
query && query.each(&add_query_param_proc)
|
86
|
-
options[:query] && options[:query].each(&add_query_param_proc)
|
87
|
-
|
88
|
-
self.class.build_query(self, query_params)
|
89
|
-
end
|
90
|
-
|
91
|
-
def build_body(body, options)
|
92
|
-
root_router.build_body(body, options)
|
93
|
-
end
|
94
|
-
|
95
|
-
def expected_response_code!(response, expected_response_codes, options)
|
96
|
-
root_router.expected_response_code!(response, expected_response_codes, options)
|
97
|
-
end
|
98
|
-
|
99
27
|
def handle_response(response, options, &block)
|
100
28
|
root_router.handle_response(response, options, &block)
|
101
29
|
end
|
102
|
-
|
103
|
-
def escape_path(path)
|
104
|
-
root_router.escape_path(path)
|
105
|
-
end
|
106
30
|
end
|
107
31
|
end
|
@@ -357,9 +357,9 @@ module ClientApiBuilder
|
|
357
357
|
add_header_proc = proc do |name, value|
|
358
358
|
headers[name] =
|
359
359
|
if value.is_a?(Proc)
|
360
|
-
instance_eval(&value)
|
360
|
+
root_router.instance_eval(&value)
|
361
361
|
elsif value.is_a?(Symbol)
|
362
|
-
send(value)
|
362
|
+
root_router.send(value)
|
363
363
|
else
|
364
364
|
value
|
365
365
|
end
|
@@ -385,9 +385,9 @@ module ClientApiBuilder
|
|
385
385
|
add_query_param_proc = proc do |name, value|
|
386
386
|
query_params[name] =
|
387
387
|
if value.is_a?(Proc)
|
388
|
-
instance_eval(&value)
|
388
|
+
root_router.instance_eval(&value)
|
389
389
|
elsif value.is_a?(Symbol)
|
390
|
-
send(value)
|
390
|
+
root_router.send(value)
|
391
391
|
else
|
392
392
|
value
|
393
393
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: client-api-builder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Doug Youch
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-01-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: inheritance-helper
|