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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 18d5c21ea26d8fe90872cc0beb09ba60dde91a1236633f9fd7786278128002cf
4
- data.tar.gz: a36757d14041a9be6478d3425e7fb8392deeec56131dd002b98e921e17961440
3
+ metadata.gz: 7ba2a10bca8dbdf440a037007da9858446a7c1b165575d49510e7ed37d9d53d6
4
+ data.tar.gz: aeb66f9fbfeeefb4d946975641dba14002706ac07117dcaca5d41d89dbf10a7d
5
5
  SHA512:
6
- metadata.gz: 2458e8f80908c9b1fcb3070626bf40d6fc1e639aa3dc994514dc6c6dbacbfffbd960a1be57f45cc3d8c79f46e5b4da42184918cf764635a46ef1ae89b815af84
7
- data.tar.gz: 62fcc2ea271b0ec346283215ce454baa1804c910afc2e6744dfa90c19d5ba812093ef83f9e8ff56c1c3f41d780e00d84f5743a626dc44c8a2ca94b3736e3df1c
6
+ metadata.gz: a346879ca1a8dac4f6c849c68fb3c2553bdb298e490a0c5da6f38768d0a18f858d08c21ddbf119bff2975f5023d38592711292240437c721e111caa7023ec5bb
7
+ data.tar.gz: 4f0faf034b9749c59cdb2c1d79adf7109e1bcd8ed1b85a1ffa189622a793d34d0f26df0c4e3a5f674700831c28f1ded0f40c8f9765657cc457e9da10b4f374e1
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'client-api-builder'
5
- s.version = '0.4.1'
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.1
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: 2022-12-22 00:00:00.000000000 Z
11
+ date: 2023-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: inheritance-helper