client-api-builder 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/Gemfile.lock +35 -33
- data/client-api-builder.gemspec +1 -1
- data/lib/client_api_builder/router.rb +28 -7
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2e5b76aafc223c8695b05460638fbd487b9ee2ad969e690f26de97d1cccf8293
|
4
|
+
data.tar.gz: 4b31ea3ef759fd3cf553d32e6b474378137e6b0badc52139068f7db9d7f87b00
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bb0d45fe8b4832a73b84a931f63ea3713a955c0d5b44a31159a54b0d454b4b63c0d29d80a379cbbcbd1c469b4b65a9e04ba238650d04e749f28918819987b65a
|
7
|
+
data.tar.gz: 752dfdf1071668e456532b1d41c1adcdbd522e09bb6a05a5c904f678a71e62014247ecc6e66a0a51fe8474fc222dee05127e9988406b95e6c5887ee6682f7f23
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
3.0.0
|
data/Gemfile.lock
CHANGED
@@ -1,60 +1,62 @@
|
|
1
1
|
GEM
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
|
-
addressable (2.
|
4
|
+
addressable (2.8.0)
|
5
5
|
public_suffix (>= 2.0.2, < 5.0)
|
6
|
-
ast (2.4.
|
6
|
+
ast (2.4.2)
|
7
7
|
crack (0.4.5)
|
8
8
|
rexml
|
9
9
|
diff-lcs (1.4.4)
|
10
|
-
docile (1.
|
10
|
+
docile (1.4.0)
|
11
11
|
hashdiff (1.0.1)
|
12
12
|
inheritance-helper (0.1.5)
|
13
|
-
parallel (1.
|
14
|
-
parser (
|
13
|
+
parallel (1.20.1)
|
14
|
+
parser (3.0.1.1)
|
15
15
|
ast (~> 2.4.1)
|
16
16
|
public_suffix (4.0.6)
|
17
17
|
rainbow (3.0.0)
|
18
|
-
rake (13.0.
|
19
|
-
regexp_parser (1.
|
20
|
-
rexml (3.2.
|
21
|
-
rspec (3.
|
22
|
-
rspec-core (~> 3.
|
23
|
-
rspec-expectations (~> 3.
|
24
|
-
rspec-mocks (~> 3.
|
25
|
-
rspec-core (3.
|
26
|
-
rspec-support (~> 3.
|
27
|
-
rspec-expectations (3.
|
18
|
+
rake (13.0.3)
|
19
|
+
regexp_parser (2.1.1)
|
20
|
+
rexml (3.2.5)
|
21
|
+
rspec (3.10.0)
|
22
|
+
rspec-core (~> 3.10.0)
|
23
|
+
rspec-expectations (~> 3.10.0)
|
24
|
+
rspec-mocks (~> 3.10.0)
|
25
|
+
rspec-core (3.10.1)
|
26
|
+
rspec-support (~> 3.10.0)
|
27
|
+
rspec-expectations (3.10.1)
|
28
28
|
diff-lcs (>= 1.2.0, < 2.0)
|
29
|
-
rspec-support (~> 3.
|
30
|
-
rspec-mocks (3.
|
29
|
+
rspec-support (~> 3.10.0)
|
30
|
+
rspec-mocks (3.10.2)
|
31
31
|
diff-lcs (>= 1.2.0, < 2.0)
|
32
|
-
rspec-support (~> 3.
|
33
|
-
rspec-support (3.
|
34
|
-
rubocop (
|
32
|
+
rspec-support (~> 3.10.0)
|
33
|
+
rspec-support (3.10.2)
|
34
|
+
rubocop (1.18.2)
|
35
35
|
parallel (~> 1.10)
|
36
|
-
parser (>=
|
36
|
+
parser (>= 3.0.0.0)
|
37
37
|
rainbow (>= 2.2.2, < 4.0)
|
38
|
-
regexp_parser (>= 1.
|
38
|
+
regexp_parser (>= 1.8, < 3.0)
|
39
39
|
rexml
|
40
|
-
rubocop-ast (>=
|
40
|
+
rubocop-ast (>= 1.7.0, < 2.0)
|
41
41
|
ruby-progressbar (~> 1.7)
|
42
|
-
unicode-display_width (>= 1.4.0, <
|
43
|
-
rubocop-ast (
|
44
|
-
parser (>=
|
45
|
-
ruby-progressbar (1.
|
46
|
-
simplecov (0.
|
42
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
43
|
+
rubocop-ast (1.7.0)
|
44
|
+
parser (>= 3.0.1.1)
|
45
|
+
ruby-progressbar (1.11.0)
|
46
|
+
simplecov (0.21.2)
|
47
47
|
docile (~> 1.1)
|
48
48
|
simplecov-html (~> 0.11)
|
49
|
-
|
50
|
-
|
51
|
-
|
49
|
+
simplecov_json_formatter (~> 0.1)
|
50
|
+
simplecov-html (0.12.3)
|
51
|
+
simplecov_json_formatter (0.1.3)
|
52
|
+
unicode-display_width (2.0.0)
|
53
|
+
webmock (3.13.0)
|
52
54
|
addressable (>= 2.3.6)
|
53
55
|
crack (>= 0.3.2)
|
54
56
|
hashdiff (>= 0.4.0, < 2.0.0)
|
55
57
|
|
56
58
|
PLATFORMS
|
57
|
-
|
59
|
+
x86_64-darwin-20
|
58
60
|
|
59
61
|
DEPENDENCIES
|
60
62
|
inheritance-helper
|
@@ -65,4 +67,4 @@ DEPENDENCIES
|
|
65
67
|
webmock
|
66
68
|
|
67
69
|
BUNDLED WITH
|
68
|
-
2.
|
70
|
+
2.2.3
|
data/client-api-builder.gemspec
CHANGED
@@ -38,9 +38,9 @@ module ClientApiBuilder
|
|
38
38
|
add_value_to_class_method(:default_options, query_builder: builder)
|
39
39
|
end
|
40
40
|
|
41
|
-
def header(name, value)
|
41
|
+
def header(name, value = nil, &block)
|
42
42
|
headers = default_options[:headers].dup
|
43
|
-
headers[name] = value
|
43
|
+
headers[name] = value || block
|
44
44
|
add_value_to_class_method(:default_options, headers: headers)
|
45
45
|
end
|
46
46
|
|
@@ -211,11 +211,23 @@ module ClientApiBuilder
|
|
211
211
|
end
|
212
212
|
|
213
213
|
def build_headers(options)
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
214
|
+
headers = {}
|
215
|
+
|
216
|
+
add_header_proc = proc do |name, value|
|
217
|
+
headers[name] =
|
218
|
+
if value.is_a?(Proc)
|
219
|
+
instance_eval(&value)
|
220
|
+
elsif value.is_a?(Symbol)
|
221
|
+
send(value)
|
222
|
+
else
|
223
|
+
value
|
224
|
+
end
|
218
225
|
end
|
226
|
+
|
227
|
+
self.class.headers.each(&add_header_proc)
|
228
|
+
options[:headers]&.each(&add_header_proc)
|
229
|
+
|
230
|
+
headers
|
219
231
|
end
|
220
232
|
|
221
233
|
def build_connection_options(options)
|
@@ -257,7 +269,16 @@ module ClientApiBuilder
|
|
257
269
|
end
|
258
270
|
|
259
271
|
def handle_response(response, options, &block)
|
260
|
-
data =
|
272
|
+
data =
|
273
|
+
case options[:return]
|
274
|
+
when :response
|
275
|
+
response
|
276
|
+
when :body
|
277
|
+
response.body
|
278
|
+
else
|
279
|
+
parse_response(response, options)
|
280
|
+
end
|
281
|
+
|
261
282
|
if block
|
262
283
|
instance_exec(data, &block)
|
263
284
|
else
|
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.2.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: 2021-
|
11
|
+
date: 2021-07-05 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Utility for constructing API clients
|
14
14
|
email: dougyouch@gmail.com
|
@@ -48,7 +48,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
48
48
|
- !ruby/object:Gem::Version
|
49
49
|
version: '0'
|
50
50
|
requirements: []
|
51
|
-
rubygems_version: 3.
|
51
|
+
rubygems_version: 3.2.3
|
52
52
|
signing_key:
|
53
53
|
specification_version: 4
|
54
54
|
summary: Develop Client API libraries faster
|