client-api-builder 0.4.1 → 0.5.0
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 -60
- 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: 38690d67b492db58ae55cea70d362d539ac4b6bf9aa07c527698af6e569ae504
|
4
|
+
data.tar.gz: 99fbfb72ff159f9b94801583cc055867ad7d6db6ddc89fff0f1072af2479a7ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ca22c8a7c1b2d3c00a3152958ecd2100e9d84d37626be484c4191cb83303f72f292d41080bbde37126d70188dd39edbedc02ee8ae672651d65a56005af00876
|
7
|
+
data.tar.gz: 9d19cd821d5468c73f308f23ac482f247709e8a580e4eb5080e1cfba1b93f277471d014d3844b93ca8a16c688cc916f29205c7d50c3ccca41bc158d842aabb21
|
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.0'
|
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'
|
@@ -40,68 +40,8 @@ module ClientApiBuilder
|
|
40
40
|
self.class.base_url || root_router.base_url
|
41
41
|
end
|
42
42
|
|
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
43
|
def handle_response(response, options, &block)
|
100
44
|
root_router.handle_response(response, options, &block)
|
101
45
|
end
|
102
|
-
|
103
|
-
def escape_path(path)
|
104
|
-
root_router.escape_path(path)
|
105
|
-
end
|
106
46
|
end
|
107
47
|
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.0
|
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-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: inheritance-helper
|