power_api 1.0.0 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (43) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +5 -0
  3. data/Gemfile +2 -0
  4. data/Gemfile.lock +93 -90
  5. data/README.md +329 -75
  6. data/app/helpers/power_api/application_helper.rb +57 -0
  7. data/bin/clean_test_app +2 -0
  8. data/lib/generators/power_api/controller/controller_generator.rb +27 -15
  9. data/lib/generators/power_api/exposed_api_config/USAGE +5 -0
  10. data/lib/generators/power_api/exposed_api_config/exposed_api_config_generator.rb +58 -0
  11. data/lib/generators/power_api/install/install_generator.rb +2 -44
  12. data/lib/generators/power_api/internal_api_config/USAGE +5 -0
  13. data/lib/generators/power_api/internal_api_config/internal_api_config_generator.rb +31 -0
  14. data/lib/generators/power_api/version/version_generator.rb +2 -2
  15. data/lib/power_api/engine.rb +8 -1
  16. data/lib/power_api/errors.rb +2 -0
  17. data/lib/power_api/generator_helper/active_record_resource.rb +10 -6
  18. data/lib/power_api/generator_helper/ams_helper.rb +5 -11
  19. data/lib/power_api/generator_helper/api_helper.rb +61 -0
  20. data/lib/power_api/generator_helper/controller_helper.rb +45 -15
  21. data/lib/power_api/generator_helper/routes_helper.rb +22 -7
  22. data/lib/power_api/generator_helper/rspec_controller_helper.rb +306 -0
  23. data/lib/power_api/generator_helper/swagger_helper.rb +14 -24
  24. data/lib/power_api/generator_helpers.rb +2 -1
  25. data/lib/power_api/version.rb +1 -1
  26. data/spec/dummy/app/controllers/api/base_controller.rb +2 -0
  27. data/spec/dummy/app/controllers/api/internal/base_controller.rb +5 -0
  28. data/spec/dummy/app/controllers/api/internal/blogs_controller.rb +36 -0
  29. data/spec/dummy/app/serializers/api/internal/blog_serializer.rb +12 -0
  30. data/spec/dummy/config/initializers/active_model_serializers.rb +1 -0
  31. data/spec/dummy/config/initializers/api_pagination.rb +32 -0
  32. data/spec/dummy/config/routes.rb +2 -7
  33. data/spec/dummy/spec/helpers/power_api/application_helper_spec.rb +171 -0
  34. data/spec/dummy/spec/lib/power_api/generator_helper/ams_helper_spec.rb +50 -12
  35. data/spec/dummy/spec/lib/power_api/generator_helper/api_helper_spec.rb +115 -0
  36. data/spec/dummy/spec/lib/power_api/generator_helper/controller_helper_spec.rb +126 -34
  37. data/spec/dummy/spec/lib/power_api/generator_helper/routes_helper_spec.rb +29 -5
  38. data/spec/dummy/spec/lib/power_api/generator_helper/rspec_controller_helper_spec.rb +559 -0
  39. data/spec/dummy/spec/lib/power_api/generator_helper/swagger_helper_spec.rb +10 -20
  40. data/spec/dummy/spec/support/shared_examples/active_record_resource_atrributes.rb +22 -3
  41. metadata +27 -5
  42. data/lib/power_api/generator_helper/version_helper.rb +0 -16
  43. data/spec/dummy/spec/lib/power_api/generator_helper/version_helper_spec.rb +0 -55
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 72ce180eb49246f087bc35f981da4813f03767f051a723c3d477da662791200c
4
- data.tar.gz: f8909d5f91216989435fff358f2e1dcc6bfd33b7938f2b80bfec3e89a04f3a84
3
+ metadata.gz: 15df7added570c9179f92d41e2bbdac7f60a9de59c9f805e7b1fce1abfbb452a
4
+ data.tar.gz: 97a4e71638625f628cf7a76049a9521c68b3abf2803e09ec48e29fe4969828ed
5
5
  SHA512:
6
- metadata.gz: d5855714804c46c69cb913b09b16c7582271271f052ff5f6050098093e33942cbaca542e58bf13b21ca1dc8757c875b22bb8a6f80d757c961d6d48d25e077de9
7
- data.tar.gz: 70924a255b888f0e1541b2a7abdfa789420b3f5bb2ae20342e67a8dd2ae91f77dcd0019f38009deb7500d41744596ecd41a0d16af53ef3b330b679870cf70fde
6
+ metadata.gz: 39389f0a07634e631eda86f606caf71080defc871b15048acb0c2aeb8e237406e04932cce9594cd63e48cbc365b6748f281f22ac45e3dc6d01e739038a7f3883
7
+ data.tar.gz: c7052f7e36848aba66e79149086a5c9a1ae1ccf1b25ac34a2964aa7cab67741d3a6f71cad79d4971d3bc62920741c2aeb6fdbc3f112dd048a7b0935cfc0275af
data/CHANGELOG.md CHANGED
@@ -1,6 +1,11 @@
1
1
  # Change Log
2
2
  All notable changes to this project will be documented in this file.
3
3
  This project adheres to [Semantic Versioning](http://semver.org/).
4
+ ### v2.0.0
5
+
6
+ * Add API internal and exposed modes.
7
+ * Replace `json_api` with `json` adapter.
8
+ * Add view helper to serialize resources.
4
9
 
5
10
  ### v1.0.0
6
11
 
data/Gemfile CHANGED
@@ -12,3 +12,5 @@ gemspec
12
12
 
13
13
  # To use a debugger
14
14
  # gem 'byebug', group: [:development, :test]
15
+
16
+ gem "api-pagination", "~> 4.8.2"
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- power_api (1.0.0)
4
+ power_api (2.0.0)
5
5
  active_model_serializers (~> 0.10.0)
6
6
  api-pagination
7
7
  kaminari
@@ -16,71 +16,71 @@ PATH
16
16
  GEM
17
17
  remote: https://rubygems.org/
18
18
  specs:
19
- actioncable (6.1.3.2)
20
- actionpack (= 6.1.3.2)
21
- activesupport (= 6.1.3.2)
19
+ actioncable (6.1.4.4)
20
+ actionpack (= 6.1.4.4)
21
+ activesupport (= 6.1.4.4)
22
22
  nio4r (~> 2.0)
23
23
  websocket-driver (>= 0.6.1)
24
- actionmailbox (6.1.3.2)
25
- actionpack (= 6.1.3.2)
26
- activejob (= 6.1.3.2)
27
- activerecord (= 6.1.3.2)
28
- activestorage (= 6.1.3.2)
29
- activesupport (= 6.1.3.2)
24
+ actionmailbox (6.1.4.4)
25
+ actionpack (= 6.1.4.4)
26
+ activejob (= 6.1.4.4)
27
+ activerecord (= 6.1.4.4)
28
+ activestorage (= 6.1.4.4)
29
+ activesupport (= 6.1.4.4)
30
30
  mail (>= 2.7.1)
31
- actionmailer (6.1.3.2)
32
- actionpack (= 6.1.3.2)
33
- actionview (= 6.1.3.2)
34
- activejob (= 6.1.3.2)
35
- activesupport (= 6.1.3.2)
31
+ actionmailer (6.1.4.4)
32
+ actionpack (= 6.1.4.4)
33
+ actionview (= 6.1.4.4)
34
+ activejob (= 6.1.4.4)
35
+ activesupport (= 6.1.4.4)
36
36
  mail (~> 2.5, >= 2.5.4)
37
37
  rails-dom-testing (~> 2.0)
38
- actionpack (6.1.3.2)
39
- actionview (= 6.1.3.2)
40
- activesupport (= 6.1.3.2)
38
+ actionpack (6.1.4.4)
39
+ actionview (= 6.1.4.4)
40
+ activesupport (= 6.1.4.4)
41
41
  rack (~> 2.0, >= 2.0.9)
42
42
  rack-test (>= 0.6.3)
43
43
  rails-dom-testing (~> 2.0)
44
44
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
45
- actiontext (6.1.3.2)
46
- actionpack (= 6.1.3.2)
47
- activerecord (= 6.1.3.2)
48
- activestorage (= 6.1.3.2)
49
- activesupport (= 6.1.3.2)
45
+ actiontext (6.1.4.4)
46
+ actionpack (= 6.1.4.4)
47
+ activerecord (= 6.1.4.4)
48
+ activestorage (= 6.1.4.4)
49
+ activesupport (= 6.1.4.4)
50
50
  nokogiri (>= 1.8.5)
51
- actionview (6.1.3.2)
52
- activesupport (= 6.1.3.2)
51
+ actionview (6.1.4.4)
52
+ activesupport (= 6.1.4.4)
53
53
  builder (~> 3.1)
54
54
  erubi (~> 1.4)
55
55
  rails-dom-testing (~> 2.0)
56
56
  rails-html-sanitizer (~> 1.1, >= 1.2.0)
57
- active_model_serializers (0.10.12)
58
- actionpack (>= 4.1, < 6.2)
59
- activemodel (>= 4.1, < 6.2)
57
+ active_model_serializers (0.10.13)
58
+ actionpack (>= 4.1, < 7.1)
59
+ activemodel (>= 4.1, < 7.1)
60
60
  case_transform (>= 0.2)
61
61
  jsonapi-renderer (>= 0.1.1.beta1, < 0.3)
62
- activejob (6.1.3.2)
63
- activesupport (= 6.1.3.2)
62
+ activejob (6.1.4.4)
63
+ activesupport (= 6.1.4.4)
64
64
  globalid (>= 0.3.6)
65
- activemodel (6.1.3.2)
66
- activesupport (= 6.1.3.2)
67
- activerecord (6.1.3.2)
68
- activemodel (= 6.1.3.2)
69
- activesupport (= 6.1.3.2)
70
- activestorage (6.1.3.2)
71
- actionpack (= 6.1.3.2)
72
- activejob (= 6.1.3.2)
73
- activerecord (= 6.1.3.2)
74
- activesupport (= 6.1.3.2)
65
+ activemodel (6.1.4.4)
66
+ activesupport (= 6.1.4.4)
67
+ activerecord (6.1.4.4)
68
+ activemodel (= 6.1.4.4)
69
+ activesupport (= 6.1.4.4)
70
+ activestorage (6.1.4.4)
71
+ actionpack (= 6.1.4.4)
72
+ activejob (= 6.1.4.4)
73
+ activerecord (= 6.1.4.4)
74
+ activesupport (= 6.1.4.4)
75
75
  marcel (~> 1.0.0)
76
- mini_mime (~> 1.0.2)
77
- activesupport (6.1.3.2)
76
+ mini_mime (>= 1.1.0)
77
+ activesupport (6.1.4.4)
78
78
  concurrent-ruby (~> 1.0, >= 1.0.2)
79
79
  i18n (>= 1.6, < 2)
80
80
  minitest (>= 5.1)
81
81
  tzinfo (~> 2.0)
82
82
  zeitwerk (~> 2.3)
83
- addressable (2.7.0)
83
+ addressable (2.8.0)
84
84
  public_suffix (>= 2.0.2, < 5.0)
85
85
  api-pagination (4.8.2)
86
86
  ast (2.4.2)
@@ -97,7 +97,7 @@ GEM
97
97
  thor (>= 0.19.4, < 2.0)
98
98
  tins (~> 1.6)
99
99
  crass (1.0.6)
100
- devise (4.8.0)
100
+ devise (4.8.1)
101
101
  bcrypt (~> 3.0)
102
102
  orm_adapter (~> 0.1)
103
103
  railties (>= 4.1.0)
@@ -113,8 +113,8 @@ GEM
113
113
  railties (>= 5.0.0)
114
114
  ffi (1.15.3)
115
115
  formatador (0.3.0)
116
- globalid (0.4.2)
117
- activesupport (>= 4.2.0)
116
+ globalid (1.0.0)
117
+ activesupport (>= 5.0)
118
118
  guard (2.17.0)
119
119
  formatador (>= 0.2.4)
120
120
  listen (>= 2.7, < 4.0)
@@ -129,43 +129,43 @@ GEM
129
129
  guard (~> 2.1)
130
130
  guard-compat (~> 1.1)
131
131
  rspec (>= 2.99.0, < 4.0)
132
- i18n (1.8.10)
132
+ i18n (1.8.11)
133
133
  concurrent-ruby (~> 1.0)
134
134
  jaro_winkler (1.5.4)
135
135
  json (2.5.1)
136
136
  json-schema (2.8.1)
137
137
  addressable (>= 2.4)
138
138
  jsonapi-renderer (0.2.2)
139
- kaminari (1.2.1)
139
+ kaminari (1.2.2)
140
140
  activesupport (>= 4.1.0)
141
- kaminari-actionview (= 1.2.1)
142
- kaminari-activerecord (= 1.2.1)
143
- kaminari-core (= 1.2.1)
144
- kaminari-actionview (1.2.1)
141
+ kaminari-actionview (= 1.2.2)
142
+ kaminari-activerecord (= 1.2.2)
143
+ kaminari-core (= 1.2.2)
144
+ kaminari-actionview (1.2.2)
145
145
  actionview
146
- kaminari-core (= 1.2.1)
147
- kaminari-activerecord (1.2.1)
146
+ kaminari-core (= 1.2.2)
147
+ kaminari-activerecord (1.2.2)
148
148
  activerecord
149
- kaminari-core (= 1.2.1)
150
- kaminari-core (1.2.1)
149
+ kaminari-core (= 1.2.2)
150
+ kaminari-core (1.2.2)
151
151
  listen (3.5.1)
152
152
  rb-fsevent (~> 0.10, >= 0.10.3)
153
153
  rb-inotify (~> 0.9, >= 0.9.10)
154
- loofah (2.10.0)
154
+ loofah (2.13.0)
155
155
  crass (~> 1.0.2)
156
156
  nokogiri (>= 1.5.9)
157
157
  lumberjack (1.2.8)
158
158
  mail (2.7.1)
159
159
  mini_mime (>= 0.1.1)
160
- marcel (1.0.1)
160
+ marcel (1.0.2)
161
161
  method_source (1.0.0)
162
- mini_mime (1.0.3)
163
- minitest (5.14.4)
162
+ mini_mime (1.1.2)
163
+ minitest (5.15.0)
164
164
  nenv (0.3.0)
165
- nio4r (2.5.7)
166
- nokogiri (1.11.7-x86_64-darwin)
165
+ nio4r (2.5.8)
166
+ nokogiri (1.13.0-x86_64-darwin)
167
167
  racc (~> 1.4)
168
- nokogiri (1.11.7-x86_64-linux)
168
+ nokogiri (1.13.0-x86_64-linux)
169
169
  racc (~> 1.4)
170
170
  notiffany (0.1.3)
171
171
  nenv (~> 0.1)
@@ -182,39 +182,39 @@ GEM
182
182
  pry (>= 0.10.4)
183
183
  psych (4.0.1)
184
184
  public_suffix (4.0.6)
185
- racc (1.5.2)
185
+ racc (1.6.0)
186
186
  rack (2.2.3)
187
187
  rack-test (1.1.0)
188
188
  rack (>= 1.0, < 3)
189
- rails (6.1.3.2)
190
- actioncable (= 6.1.3.2)
191
- actionmailbox (= 6.1.3.2)
192
- actionmailer (= 6.1.3.2)
193
- actionpack (= 6.1.3.2)
194
- actiontext (= 6.1.3.2)
195
- actionview (= 6.1.3.2)
196
- activejob (= 6.1.3.2)
197
- activemodel (= 6.1.3.2)
198
- activerecord (= 6.1.3.2)
199
- activestorage (= 6.1.3.2)
200
- activesupport (= 6.1.3.2)
189
+ rails (6.1.4.4)
190
+ actioncable (= 6.1.4.4)
191
+ actionmailbox (= 6.1.4.4)
192
+ actionmailer (= 6.1.4.4)
193
+ actionpack (= 6.1.4.4)
194
+ actiontext (= 6.1.4.4)
195
+ actionview (= 6.1.4.4)
196
+ activejob (= 6.1.4.4)
197
+ activemodel (= 6.1.4.4)
198
+ activerecord (= 6.1.4.4)
199
+ activestorage (= 6.1.4.4)
200
+ activesupport (= 6.1.4.4)
201
201
  bundler (>= 1.15.0)
202
- railties (= 6.1.3.2)
202
+ railties (= 6.1.4.4)
203
203
  sprockets-rails (>= 2.0.0)
204
204
  rails-dom-testing (2.0.3)
205
205
  activesupport (>= 4.2.0)
206
206
  nokogiri (>= 1.6)
207
- rails-html-sanitizer (1.3.0)
207
+ rails-html-sanitizer (1.4.2)
208
208
  loofah (~> 2.3)
209
- railties (6.1.3.2)
210
- actionpack (= 6.1.3.2)
211
- activesupport (= 6.1.3.2)
209
+ railties (6.1.4.4)
210
+ actionpack (= 6.1.4.4)
211
+ activesupport (= 6.1.4.4)
212
212
  method_source
213
- rake (>= 0.8.7)
213
+ rake (>= 0.13)
214
214
  thor (~> 1.0)
215
215
  rainbow (3.0.0)
216
- rake (13.0.3)
217
- ransack (2.4.2)
216
+ rake (13.0.6)
217
+ ransack (2.5.0)
218
218
  activerecord (>= 5.2.4)
219
219
  activesupport (>= 5.2.4)
220
220
  i18n
@@ -281,15 +281,15 @@ GEM
281
281
  sprockets (4.0.2)
282
282
  concurrent-ruby (~> 1.0)
283
283
  rack (> 1, < 3)
284
- sprockets-rails (3.2.2)
285
- actionpack (>= 4.0)
286
- activesupport (>= 4.0)
284
+ sprockets-rails (3.4.2)
285
+ actionpack (>= 5.2)
286
+ activesupport (>= 5.2)
287
287
  sprockets (>= 3.0.0)
288
288
  sqlite3 (1.4.2)
289
289
  sync (0.5.0)
290
290
  term-ansicolor (1.7.1)
291
291
  tins (~> 1.0)
292
- thor (1.1.0)
292
+ thor (1.2.1)
293
293
  tins (1.29.1)
294
294
  sync
295
295
  tzinfo (2.0.4)
@@ -301,17 +301,20 @@ GEM
301
301
  yard (~> 0.9.11)
302
302
  warden (1.2.9)
303
303
  rack (>= 2.0.9)
304
+ webrick (1.7.0)
304
305
  websocket-driver (0.7.5)
305
306
  websocket-extensions (>= 0.1.0)
306
307
  websocket-extensions (0.1.5)
307
- yard (0.9.26)
308
- zeitwerk (2.4.2)
308
+ yard (0.9.27)
309
+ webrick (~> 1.7.0)
310
+ zeitwerk (2.5.3)
309
311
 
310
312
  PLATFORMS
311
313
  x86_64-darwin-20
312
314
  x86_64-linux
313
315
 
314
316
  DEPENDENCIES
317
+ api-pagination (~> 4.8.2)
315
318
  coveralls
316
319
  factory_bot_rails
317
320
  guard-rspec