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 +4 -4
- data/client-api-builder.gemspec +1 -1
- data/lib/client_api_builder/nested_router.rb +6 -3
- data/lib/client_api_builder/section.rb +2 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 22b0877a7db8197b265529650ceb1f9c9be7269ebd7f13a9172f79f218a066d0
|
4
|
+
data.tar.gz: 0e265efc80476f256a133594cddeeafac7cc0addd63415ffd830d2fedb4ea66c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5e09ef235f9784b004d819def746f19587836e51ca93cccf25496626acf519e22d3edf20ed59c0fb58333575235ca19d90c9ad540c6d0ecb26c5de0dd319fab3
|
7
|
+
data.tar.gz: 513d91d8567ed57456c0db09e66b373caad85bc157a1ab7a7cb7ff17d8cce2e320cdbe9fd1f74382f5da7e0b46c0fe431819bf20c30508fc933df24f73958a5a
|
data/client-api-builder.gemspec
CHANGED
@@ -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__
|