jat 0.0.6 → 0.0.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/lib/jat/attribute.rb +5 -18
  3. data/lib/jat/config.rb +5 -20
  4. data/lib/jat/plugins/{common/_activerecord_preloads/_activerecord_preloads.rb → base/base_activerecord_preloads/base_activerecord_preloads.rb} +3 -3
  5. data/lib/jat/plugins/{common/_activerecord_preloads → base/base_activerecord_preloads}/lib/preloader.rb +3 -1
  6. data/lib/jat/plugins/{common/_lower_camel_case/_lower_camel_case.rb → base/base_lower_camel_case/base_lower_camel_case.rb} +3 -3
  7. data/lib/jat/plugins/{common/_preloads/_preloads.rb → base/base_preloads/base_preloads.rb} +3 -3
  8. data/lib/jat/plugins/{common/_preloads → base/base_preloads}/lib/format_user_preloads.rb +1 -1
  9. data/lib/jat/plugins/{common/_preloads → base/base_preloads}/lib/preloads_with_path.rb +1 -1
  10. data/lib/jat/plugins/json_api/lib/fields_param_parser.rb +1 -10
  11. data/lib/jat/plugins/json_api/lib/include_param_parser.rb +1 -10
  12. data/lib/jat/plugins/json_api/lib/map.rb +5 -15
  13. data/lib/jat/plugins/json_api/lib/response.rb +2 -15
  14. data/lib/jat/plugins/json_api/lib/response_piece.rb +10 -19
  15. data/lib/jat/plugins/json_api/plugins/json_api_activerecord/json_api_activerecord.rb +1 -1
  16. data/lib/jat/plugins/json_api/plugins/json_api_lower_camel_case/json_api_lower_camel_case.rb +1 -1
  17. data/lib/jat/plugins/json_api/plugins/json_api_preloads/json_api_preloads.rb +1 -1
  18. data/lib/jat/plugins/json_api/plugins/json_api_validate_params/lib/validate_include_param.rb +1 -3
  19. data/lib/jat/plugins/presenter/presenter.rb +79 -0
  20. data/lib/jat/plugins/simple_api/lib/fields_param_parser.rb +21 -46
  21. data/lib/jat/plugins/simple_api/lib/map.rb +5 -15
  22. data/lib/jat/plugins/simple_api/lib/response.rb +2 -15
  23. data/lib/jat/plugins/simple_api/lib/response_piece.rb +2 -15
  24. data/lib/jat/plugins/simple_api/plugins/simple_api_activerecord/simple_api_activerecord.rb +1 -1
  25. data/lib/jat/plugins/simple_api/plugins/simple_api_lower_camel_case/simple_api_lower_camel_case.rb +1 -1
  26. data/lib/jat/plugins/simple_api/plugins/simple_api_preloads/simple_api_preloads.rb +1 -1
  27. data/lib/jat/plugins/simple_api/plugins/simple_api_validate_params/simple_api_validate_params.rb +1 -1
  28. data/lib/jat/plugins/simple_api/simple_api.rb +1 -1
  29. data/lib/jat/plugins/types/types.rb +55 -0
  30. data/lib/jat/plugins.rb +38 -25
  31. data/lib/jat/utils/jat_class.rb +21 -0
  32. data/lib/jat.rb +9 -6
  33. data/test/lib/jat/attribute_test.rb +8 -0
  34. data/test/lib/jat/plugins/activerecord/activerecord_test.rb +27 -0
  35. data/test/lib/jat/plugins/{_activerecord_preloads/_activerecord_preloads_test.rb → base_activerecord_preloads/base_activerecord_preloads_test.rb} +3 -3
  36. data/test/lib/jat/plugins/{_activerecord_preloads → base_activerecord_preloads}/lib/preloader_test.rb +2 -2
  37. data/test/lib/jat/plugins/{_camel_lower/_camel_lower_test.rb → base_lower_camel_case/base_lower_camel_case_test.rb} +2 -2
  38. data/test/lib/jat/plugins/{_preloads/_preloads_test.rb → base_preloads/base_preloads_test.rb} +2 -2
  39. data/test/lib/jat/plugins/{_preloads → base_preloads}/lib/format_user_preloads_test.rb +3 -3
  40. data/test/lib/jat/plugins/{_preloads → base_preloads}/lib/preloads_with_path_test.rb +2 -2
  41. data/test/lib/jat/plugins/json_api/json_api_test.rb +1 -1
  42. data/test/lib/jat/plugins/json_api/lib/fields_param_parser_test.rb +20 -12
  43. data/test/lib/jat/plugins/json_api/lib/include_param_parser_test.rb +25 -11
  44. data/test/lib/jat/plugins/json_api/lib/map_test.rb +132 -124
  45. data/test/lib/jat/plugins/json_api/lib/response_piece_test.rb +13 -0
  46. data/test/lib/jat/plugins/json_api/lib/response_test.rb +6 -1
  47. data/test/lib/jat/plugins/json_api_activerecord/json_api_activerecord_test.rb +1 -1
  48. 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
  49. data/test/lib/jat/plugins/json_api_preloads/json_api_preloads_test.rb +16 -2
  50. data/test/lib/jat/plugins/json_api_preloads/lib/preloads_test.rb +0 -3
  51. data/test/lib/jat/plugins/json_api_validate_params/json_api_validate_params_test.rb +30 -6
  52. data/test/lib/jat/plugins/lower_camel_case/lower_camel_case_test.rb +27 -0
  53. data/test/lib/jat/plugins/maps_cache/maps_cache_test.rb +27 -0
  54. data/test/lib/jat/plugins/preloads/preloads_test.rb +27 -0
  55. data/test/lib/jat/plugins/presenter/presenter_test.rb +215 -0
  56. data/test/lib/jat/plugins/simple_api/lib/fields_param_parser_test.rb +57 -43
  57. data/test/lib/jat/plugins/simple_api/lib/map_test.rb +90 -82
  58. data/test/lib/jat/plugins/simple_api/lib/response_piece_test.rb +13 -0
  59. data/test/lib/jat/plugins/simple_api/lib/response_test.rb +17 -11
  60. data/test/lib/jat/plugins/simple_api/simple_api_test.rb +36 -1
  61. data/test/lib/jat/plugins/simple_api_activerecord/simple_api_activerecord_test.rb +1 -1
  62. 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
  63. data/test/lib/jat/plugins/simple_api_preloads/lib/preloads_test.rb +1 -6
  64. data/test/lib/jat/plugins/simple_api_preloads/simple_api_preloads_test.rb +16 -2
  65. data/test/lib/jat/plugins/simple_api_validate_params/simple_api_validate_params_test.rb +12 -0
  66. data/test/lib/jat/plugins/types/types_test.rb +83 -0
  67. data/test/lib/jat/plugins/validate_params/validate_params_test.rb +27 -0
  68. data/test/lib/jat/plugins_test.rb +89 -0
  69. data/test/test_helper.rb +14 -4
  70. metadata +72 -67
  71. data/test/lib/plugin_test.rb +0 -49
  72. 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