client-api-builder 0.2.9 → 0.3.0

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: 201c8daf4abbc1489d26007b97c9b50145cffd98c699c2918d8f929138a1ef70
4
- data.tar.gz: 627baef257a7d3a8037fa38eb5fa2e1c4f99f3ef0d191f083114f187e5690a30
3
+ metadata.gz: 22b0877a7db8197b265529650ceb1f9c9be7269ebd7f13a9172f79f218a066d0
4
+ data.tar.gz: 0e265efc80476f256a133594cddeeafac7cc0addd63415ffd830d2fedb4ea66c
5
5
  SHA512:
6
- metadata.gz: cc3b8a34104099c0ab3bdcbf66c611286fe07841eac76e7d6ddbfebe5e97d5b374c0f52e9c47b3d9f1e49761ee0fca02565862875f48c932a31bd7d8f07543aa
7
- data.tar.gz: 00216ed9808389eb0f41c9a084527f7311c1e13ad525945a2a920d39aca55e48c395471dd3bcb0ead25db8f6bb08f73f99693cc853e232534d298eff3bfbba31
6
+ metadata.gz: 5e09ef235f9784b004d819def746f19587836e51ca93cccf25496626acf519e22d3edf20ed59c0fb58333575235ca19d90c9ad540c6d0ecb26c5de0dd319fab3
7
+ data.tar.gz: 513d91d8567ed57456c0db09e66b373caad85bc157a1ab7a7cb7ff17d8cce2e320cdbe9fd1f74382f5da7e0b46c0fe431819bf20c30508fc933df24f73958a5a
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'client-api-builder'
5
- s.version = '0.2.9'
5
+ s.version = '0.3.0'
6
6
  s.licenses = ['MIT']
7
7
  s.summary = 'Develop Client API libraries faster'
8
8
  s.description = 'Utility for constructing API clients'
@@ -8,10 +8,12 @@ module ClientApiBuilder
8
8
  class NestedRouter
9
9
  include ::ClientApiBuilder::Router
10
10
 
11
- attr_reader :root_router
11
+ attr_reader :root_router,
12
+ :nested_router_options
12
13
 
13
- def initialize(root_router)
14
+ def initialize(root_router, nested_router_options)
14
15
  @root_router = root_router
16
+ @nested_router_options = nested_router_options
15
17
  end
16
18
 
17
19
  def self.get_instance_method(var)
@@ -39,7 +41,7 @@ module ClientApiBuilder
39
41
  end
40
42
 
41
43
  def build_headers(options)
42
- headers = root_router.build_headers(options)
44
+ headers = nested_router_options[:ignore_headers] ? {} : root_router.build_headers(options)
43
45
 
44
46
  add_header_proc = proc do |name, value|
45
47
  headers[name] =
@@ -63,6 +65,7 @@ module ClientApiBuilder
63
65
 
64
66
  def build_query(query, options)
65
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?
66
69
 
67
70
  query_params = {}
68
71
 
@@ -8,7 +8,7 @@ module ClientApiBuilder
8
8
  end
9
9
 
10
10
  module ClassMethods
11
- def section(name, &block)
11
+ def section(name, nested_router_options={}, &block)
12
12
  kls = InheritanceHelper::ClassBuilder::Utils.create_class(
13
13
  self,
14
14
  name,
@@ -24,7 +24,7 @@ def self.#{name}_router
24
24
  end
25
25
 
26
26
  def #{name}
27
- @#{name} ||= self.class.#{name}_router.new(self.root_router)
27
+ @#{name} ||= self.class.#{name}_router.new(self.root_router, #{nested_router_options.inspect})
28
28
  end
29
29
  CODE
30
30
  self.class_eval code, __FILE__, __LINE__
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: client-api-builder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.9
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Doug Youch