jat 0.0.6 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/jat/attribute.rb +5 -18
- data/lib/jat/config.rb +5 -20
- data/lib/jat/plugins/{common/_activerecord_preloads/_activerecord_preloads.rb → base/base_activerecord_preloads/base_activerecord_preloads.rb} +3 -3
- data/lib/jat/plugins/{common/_activerecord_preloads → base/base_activerecord_preloads}/lib/preloader.rb +3 -1
- data/lib/jat/plugins/{common/_lower_camel_case/_lower_camel_case.rb → base/base_lower_camel_case/base_lower_camel_case.rb} +3 -3
- data/lib/jat/plugins/{common/_preloads/_preloads.rb → base/base_preloads/base_preloads.rb} +3 -3
- data/lib/jat/plugins/{common/_preloads → base/base_preloads}/lib/format_user_preloads.rb +1 -1
- data/lib/jat/plugins/{common/_preloads → base/base_preloads}/lib/preloads_with_path.rb +1 -1
- data/lib/jat/plugins/json_api/lib/fields_param_parser.rb +1 -10
- data/lib/jat/plugins/json_api/lib/include_param_parser.rb +1 -10
- data/lib/jat/plugins/json_api/lib/map.rb +5 -15
- data/lib/jat/plugins/json_api/lib/response.rb +2 -15
- data/lib/jat/plugins/json_api/lib/response_piece.rb +10 -19
- data/lib/jat/plugins/json_api/plugins/json_api_activerecord/json_api_activerecord.rb +1 -1
- data/lib/jat/plugins/json_api/plugins/json_api_lower_camel_case/json_api_lower_camel_case.rb +1 -1
- data/lib/jat/plugins/json_api/plugins/json_api_preloads/json_api_preloads.rb +1 -1
- data/lib/jat/plugins/json_api/plugins/json_api_validate_params/lib/validate_include_param.rb +1 -3
- data/lib/jat/plugins/presenter/presenter.rb +79 -0
- data/lib/jat/plugins/simple_api/lib/fields_param_parser.rb +21 -46
- data/lib/jat/plugins/simple_api/lib/map.rb +5 -15
- data/lib/jat/plugins/simple_api/lib/response.rb +2 -15
- data/lib/jat/plugins/simple_api/lib/response_piece.rb +2 -15
- data/lib/jat/plugins/simple_api/plugins/simple_api_activerecord/simple_api_activerecord.rb +1 -1
- data/lib/jat/plugins/simple_api/plugins/simple_api_lower_camel_case/simple_api_lower_camel_case.rb +1 -1
- data/lib/jat/plugins/simple_api/plugins/simple_api_preloads/simple_api_preloads.rb +1 -1
- data/lib/jat/plugins/simple_api/plugins/simple_api_validate_params/simple_api_validate_params.rb +1 -1
- data/lib/jat/plugins/simple_api/simple_api.rb +1 -1
- data/lib/jat/plugins/types/types.rb +55 -0
- data/lib/jat/plugins.rb +38 -25
- data/lib/jat/utils/jat_class.rb +21 -0
- data/lib/jat.rb +9 -6
- data/test/lib/jat/attribute_test.rb +8 -0
- data/test/lib/jat/plugins/activerecord/activerecord_test.rb +27 -0
- data/test/lib/jat/plugins/{_activerecord_preloads/_activerecord_preloads_test.rb → base_activerecord_preloads/base_activerecord_preloads_test.rb} +3 -3
- data/test/lib/jat/plugins/{_activerecord_preloads → base_activerecord_preloads}/lib/preloader_test.rb +2 -2
- data/test/lib/jat/plugins/{_camel_lower/_camel_lower_test.rb → base_lower_camel_case/base_lower_camel_case_test.rb} +2 -2
- data/test/lib/jat/plugins/{_preloads/_preloads_test.rb → base_preloads/base_preloads_test.rb} +2 -2
- data/test/lib/jat/plugins/{_preloads → base_preloads}/lib/format_user_preloads_test.rb +3 -3
- data/test/lib/jat/plugins/{_preloads → base_preloads}/lib/preloads_with_path_test.rb +2 -2
- data/test/lib/jat/plugins/json_api/json_api_test.rb +1 -1
- data/test/lib/jat/plugins/json_api/lib/fields_param_parser_test.rb +20 -12
- data/test/lib/jat/plugins/json_api/lib/include_param_parser_test.rb +25 -11
- data/test/lib/jat/plugins/json_api/lib/map_test.rb +132 -124
- data/test/lib/jat/plugins/json_api/lib/response_piece_test.rb +13 -0
- data/test/lib/jat/plugins/json_api/lib/response_test.rb +6 -1
- data/test/lib/jat/plugins/json_api_activerecord/json_api_activerecord_test.rb +1 -1
- data/test/lib/jat/plugins/{json_api_camel_lower/json_api_camel_lower_test.rb → json_api_lower_camel_case/json_api_lower_camel_case_test.rb} +6 -0
- data/test/lib/jat/plugins/json_api_preloads/json_api_preloads_test.rb +16 -2
- data/test/lib/jat/plugins/json_api_preloads/lib/preloads_test.rb +0 -3
- data/test/lib/jat/plugins/json_api_validate_params/json_api_validate_params_test.rb +30 -6
- data/test/lib/jat/plugins/lower_camel_case/lower_camel_case_test.rb +27 -0
- data/test/lib/jat/plugins/maps_cache/maps_cache_test.rb +27 -0
- data/test/lib/jat/plugins/preloads/preloads_test.rb +27 -0
- data/test/lib/jat/plugins/presenter/presenter_test.rb +215 -0
- data/test/lib/jat/plugins/simple_api/lib/fields_param_parser_test.rb +57 -43
- data/test/lib/jat/plugins/simple_api/lib/map_test.rb +90 -82
- data/test/lib/jat/plugins/simple_api/lib/response_piece_test.rb +13 -0
- data/test/lib/jat/plugins/simple_api/lib/response_test.rb +17 -11
- data/test/lib/jat/plugins/simple_api/simple_api_test.rb +36 -1
- data/test/lib/jat/plugins/simple_api_activerecord/simple_api_activerecord_test.rb +1 -1
- data/test/lib/jat/plugins/{simple_api_camel_lower/simple_api_camel_lower_test.rb → simple_api_lower_camel_case/simple_api_lower_camel_case_test.rb} +7 -1
- data/test/lib/jat/plugins/simple_api_preloads/lib/preloads_test.rb +1 -6
- data/test/lib/jat/plugins/simple_api_preloads/simple_api_preloads_test.rb +16 -2
- data/test/lib/jat/plugins/simple_api_validate_params/simple_api_validate_params_test.rb +12 -0
- data/test/lib/jat/plugins/types/types_test.rb +83 -0
- data/test/lib/jat/plugins/validate_params/validate_params_test.rb +27 -0
- data/test/lib/jat/plugins_test.rb +89 -0
- data/test/test_helper.rb +14 -4
- metadata +72 -67
- data/test/lib/plugin_test.rb +0 -49
- data/test/test_plugin.rb +0 -56
data/test/test_plugin.rb
DELETED
@@ -1,56 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module TestPlugin
|
4
|
-
def self.before_load(jat_class, *)
|
5
|
-
jat_class.config[:before_load] = jat_class.foo
|
6
|
-
end
|
7
|
-
|
8
|
-
def self.load(jat_class, **_opts)
|
9
|
-
jat_class.extend(ClassMethods)
|
10
|
-
jat_class.include(InstanceMethods)
|
11
|
-
jat_class::Attribute.extend(AttributeClassMethods)
|
12
|
-
jat_class::Attribute.include(AttributeMethods)
|
13
|
-
jat_class::Config.extend(ConfigClassMethods)
|
14
|
-
jat_class::Config.include(ConfigMethods)
|
15
|
-
end
|
16
|
-
|
17
|
-
def self.after_load(jat_class, *)
|
18
|
-
jat_class.config[:after_load] = jat_class.foo
|
19
|
-
end
|
20
|
-
|
21
|
-
module ClassMethods
|
22
|
-
def foo
|
23
|
-
:plugin_foo
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
module InstanceMethods
|
28
|
-
def foo
|
29
|
-
:plugin_foo
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
module AttributeClassMethods
|
34
|
-
def foo
|
35
|
-
:plugin_foo
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
module AttributeMethods
|
40
|
-
def foo
|
41
|
-
:plugin_foo
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
module ConfigClassMethods
|
46
|
-
def foo
|
47
|
-
:plugin_foo
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
module ConfigMethods
|
52
|
-
def foo
|
53
|
-
:plugin_foo
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|