linked_rails 0.0.3 → 0.0.4.pre.g14b377f91

Sign up to get free protection for your applications and to get access to all the features.
Files changed (173) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE +21 -674
  3. data/app/controllers/linked_rails/actions/objects_controller.rb +9 -0
  4. data/app/controllers/linked_rails/bulk_controller.rb +71 -21
  5. data/app/controllers/linked_rails/enum_values_controller.rb +0 -42
  6. data/app/models/linked_rails/actions/item.rb +64 -55
  7. data/app/models/linked_rails/actions/list.rb +6 -31
  8. data/app/models/linked_rails/actions/object.rb +38 -0
  9. data/app/models/linked_rails/collection/configuration.rb +55 -0
  10. data/app/models/linked_rails/collection/filter.rb +1 -1
  11. data/app/models/linked_rails/collection/filter_field.rb +19 -2
  12. data/app/models/linked_rails/collection/filter_option.rb +1 -1
  13. data/app/models/linked_rails/collection/filterable.rb +6 -9
  14. data/app/models/linked_rails/collection/infinite.rb +113 -0
  15. data/app/models/linked_rails/collection/infinite_view.rb +1 -90
  16. data/app/models/linked_rails/collection/iri.rb +47 -43
  17. data/app/models/linked_rails/collection/iri_mapping.rb +15 -7
  18. data/app/models/linked_rails/collection/paginated.rb +46 -0
  19. data/app/models/linked_rails/collection/paginated_view.rb +1 -33
  20. data/app/models/linked_rails/collection/sortable.rb +1 -9
  21. data/app/models/linked_rails/collection/sorting.rb +1 -1
  22. data/app/models/linked_rails/collection/view.rb +51 -14
  23. data/app/models/linked_rails/collection.rb +53 -85
  24. data/app/models/linked_rails/creative_work.rb +1 -1
  25. data/app/models/linked_rails/entry_point.rb +8 -5
  26. data/app/models/linked_rails/enum_value.rb +40 -2
  27. data/app/models/linked_rails/form/field/association_input.rb +7 -1
  28. data/app/models/linked_rails/form/field/file_input.rb +1 -0
  29. data/app/models/linked_rails/form/field/resource_field.rb +2 -0
  30. data/{lib/linked_rails/enhancements/indexable/model.rb → app/models/linked_rails/form/field/url_input.rb} +3 -3
  31. data/app/models/linked_rails/form/field.rb +37 -13
  32. data/app/models/linked_rails/form/field_factory.rb +48 -18
  33. data/app/models/linked_rails/form/group.rb +4 -6
  34. data/app/models/linked_rails/form/page.rb +8 -4
  35. data/app/models/linked_rails/form.rb +16 -21
  36. data/app/models/linked_rails/manifest.rb +104 -22
  37. data/app/models/linked_rails/menus/item.rb +10 -13
  38. data/app/models/linked_rails/menus/list.rb +16 -7
  39. data/app/models/linked_rails/ontology/base.rb +3 -1
  40. data/app/models/linked_rails/ontology/class.rb +3 -3
  41. data/app/models/linked_rails/ontology.rb +5 -5
  42. data/app/models/linked_rails/property_query.rb +2 -0
  43. data/app/models/linked_rails/sequence.rb +4 -13
  44. data/app/models/linked_rails/shacl/property_shape.rb +1 -1
  45. data/app/models/linked_rails/web_page.rb +0 -4
  46. data/app/models/linked_rails/web_site.rb +0 -4
  47. data/app/models/linked_rails/widget.rb +4 -11
  48. data/app/policies/linked_rails/actions/object_policy.rb +11 -0
  49. data/app/policies/linked_rails/collection_policy.rb +2 -2
  50. data/app/serializers/linked_rails/actions/item_serializer.rb +5 -5
  51. data/app/serializers/linked_rails/actions/object_serializer.rb +9 -0
  52. data/app/serializers/linked_rails/collection/filter_field_serializer.rb +3 -2
  53. data/app/serializers/linked_rails/collection/filter_option_serializer.rb +1 -1
  54. data/app/serializers/linked_rails/collection/filter_serializer.rb +1 -1
  55. data/app/serializers/linked_rails/collection/sorting_serializer.rb +1 -1
  56. data/app/serializers/linked_rails/collection/view_serializer.rb +3 -3
  57. data/app/serializers/linked_rails/collection_serializer.rb +8 -7
  58. data/app/serializers/linked_rails/condition_serializer.rb +3 -3
  59. data/app/serializers/linked_rails/entry_point_serializer.rb +3 -3
  60. data/app/serializers/linked_rails/enum_value_serializer.rb +1 -0
  61. data/app/serializers/linked_rails/form/field/association_input_serializer.rb +1 -0
  62. data/app/serializers/linked_rails/form/field/file_input_serializer.rb +11 -0
  63. data/app/serializers/linked_rails/form/field_serializer.rb +3 -1
  64. data/app/serializers/linked_rails/form/group_serializer.rb +1 -1
  65. data/app/serializers/linked_rails/form/page_serializer.rb +1 -1
  66. data/app/serializers/linked_rails/menus/item_serializer.rb +3 -3
  67. data/app/serializers/linked_rails/menus/list_serializer.rb +1 -1
  68. data/app/serializers/linked_rails/ontology_serializer.rb +2 -2
  69. data/app/serializers/linked_rails/property_query_serializer.rb +7 -0
  70. data/app/serializers/linked_rails/sequence_serializer.rb +2 -5
  71. data/app/serializers/linked_rails/shacl/node_shape_serializer.rb +1 -1
  72. data/app/serializers/linked_rails/shacl/property_shape_serializer.rb +1 -1
  73. data/app/serializers/linked_rails/shacl/shape_serializer.rb +5 -5
  74. data/app/serializers/linked_rails/web_page_serializer.rb +3 -3
  75. data/app/serializers/linked_rails/web_site_serializer.rb +1 -1
  76. data/app/serializers/linked_rails/widget_serializer.rb +3 -3
  77. data/lib/generators/linked_rails/install/install_generator.rb +5 -8
  78. data/lib/generators/linked_rails/install/templates/README +2 -0
  79. data/lib/generators/linked_rails/install/templates/app_menu_list.rb +36 -7
  80. data/lib/generators/linked_rails/install/templates/application_menu_list.rb +40 -1
  81. data/lib/generators/linked_rails/install/templates/initializer.rb +1 -2
  82. data/lib/generators/linked_rails/install/templates/locales.yml +14 -0
  83. data/lib/generators/linked_rails/install/templates/rdf_serializers_initializer.rb +1 -1
  84. data/lib/generators/linked_rails/install/templates/vocab.rb +1 -0
  85. data/lib/generators/linked_rails/install/templates/vocab.yml +2 -2
  86. data/lib/generators/linked_rails/model/model_generator.rb +0 -1
  87. data/lib/generators/linked_rails/model/templates/controller.rb.tt +5 -1
  88. data/lib/generators/linked_rails/model/templates/form.rb.tt +3 -0
  89. data/lib/generators/linked_rails/model/templates/menu_list.rb.tt +15 -0
  90. data/lib/generators/linked_rails/model/templates/policy.rb.tt +13 -0
  91. data/lib/generators/linked_rails/model/templates/serializer.rb.tt +5 -1
  92. data/lib/linked_rails/active_response/controller/collections.rb +1 -1
  93. data/lib/linked_rails/active_response/controller/crud_defaults.rb +4 -4
  94. data/lib/linked_rails/active_response/controller/params.rb +10 -10
  95. data/lib/linked_rails/active_response/controller.rb +8 -18
  96. data/lib/linked_rails/active_response/responders/rdf.rb +19 -10
  97. data/lib/linked_rails/callable_variable.rb +1 -1
  98. data/lib/linked_rails/collection_params_parser.rb +93 -0
  99. data/lib/linked_rails/controller/actionable.rb +121 -0
  100. data/lib/linked_rails/controller/authorization.rb +6 -0
  101. data/lib/linked_rails/controller/default_actions/create.rb +52 -0
  102. data/lib/linked_rails/controller/default_actions/destroy.rb +42 -0
  103. data/lib/linked_rails/controller/default_actions/update.rb +43 -0
  104. data/lib/linked_rails/controller/delta.rb +58 -0
  105. data/lib/linked_rails/controller/error_handling.rb +10 -10
  106. data/lib/linked_rails/controller/rendering.rb +48 -0
  107. data/lib/linked_rails/controller.rb +24 -4
  108. data/lib/linked_rails/enhancements/creatable/controller.rb +1 -1
  109. data/lib/linked_rails/enhancements/destroyable/controller.rb +1 -1
  110. data/lib/linked_rails/enhancements/updatable/controller.rb +1 -1
  111. data/lib/linked_rails/enhancements.rb +0 -16
  112. data/lib/linked_rails/helpers/delta_helper.rb +26 -57
  113. data/lib/linked_rails/helpers/ontola_actions_helper.rb +2 -2
  114. data/lib/linked_rails/helpers/resource_helper.rb +4 -2
  115. data/lib/linked_rails/iri_mapper.rb +17 -39
  116. data/lib/linked_rails/middleware/error_handling.rb +51 -0
  117. data/lib/linked_rails/middleware/linked_data_params.rb +30 -151
  118. data/lib/linked_rails/model/actionable.rb +68 -0
  119. data/lib/linked_rails/model/collections.rb +201 -39
  120. data/lib/linked_rails/model/dirty.rb +6 -18
  121. data/lib/linked_rails/model/enhancements.rb +1 -6
  122. data/lib/linked_rails/model/filtering.rb +4 -6
  123. data/lib/linked_rails/model/indexable.rb +6 -16
  124. data/lib/linked_rails/model/iri.rb +28 -19
  125. data/lib/linked_rails/model/iri_mapping.rb +37 -8
  126. data/lib/linked_rails/model/menuable.rb +28 -0
  127. data/lib/linked_rails/model/serialization.rb +2 -15
  128. data/lib/linked_rails/model/singularable.rb +57 -0
  129. data/lib/linked_rails/model/sorting.rb +0 -5
  130. data/lib/linked_rails/model/tables.rb +26 -0
  131. data/lib/linked_rails/model.rb +17 -7
  132. data/lib/linked_rails/params_parser.rb +131 -54
  133. data/lib/linked_rails/policy/attribute_conditions.rb +2 -2
  134. data/lib/linked_rails/policy.rb +40 -46
  135. data/lib/linked_rails/railtie.rb +11 -0
  136. data/lib/linked_rails/rdf_error.rb +2 -2
  137. data/lib/linked_rails/renderers.rb +1 -0
  138. data/lib/linked_rails/routes.rb +38 -22
  139. data/lib/linked_rails/serializer/actionable.rb +27 -0
  140. data/lib/linked_rails/serializer/menuable.rb +31 -0
  141. data/lib/linked_rails/serializer/singularable.rb +26 -0
  142. data/lib/linked_rails/serializer.rb +28 -11
  143. data/lib/linked_rails/test_methods.rb +114 -0
  144. data/lib/linked_rails/translate.rb +31 -9
  145. data/lib/linked_rails/types/iri_type.rb +37 -0
  146. data/lib/linked_rails/uri_template.rb +30 -0
  147. data/lib/linked_rails/version.rb +1 -1
  148. data/lib/linked_rails/vocab.rb +9 -0
  149. data/lib/linked_rails.rb +30 -13
  150. data/lib/rails/welcome_controller.rb +3 -3
  151. data/lib/rdf/list.rb +9 -0
  152. data/lib/rdf/query_fix.rb +15 -0
  153. metadata +71 -33
  154. data/app/models/linked_rails/actions/default_actions/create.rb +0 -60
  155. data/app/models/linked_rails/actions/default_actions/destroy.rb +0 -45
  156. data/app/models/linked_rails/actions/default_actions/update.rb +0 -50
  157. data/app/models/linked_rails/actions/default_actions.rb +0 -17
  158. data/lib/generators/linked_rails/install/templates/application_action_list.rb +0 -3
  159. data/lib/generators/linked_rails/model/templates/action_list.rb.tt +0 -6
  160. data/lib/linked_rails/enhancements/actionable/model.rb +0 -71
  161. data/lib/linked_rails/enhancements/actionable/serializer.rb +0 -25
  162. data/lib/linked_rails/enhancements/creatable/action.rb +0 -15
  163. data/lib/linked_rails/enhancements/destroyable/action.rb +0 -15
  164. data/lib/linked_rails/enhancements/destroyable/routing.rb +0 -19
  165. data/lib/linked_rails/enhancements/menuable/model.rb +0 -36
  166. data/lib/linked_rails/enhancements/menuable/serializer.rb +0 -33
  167. data/lib/linked_rails/enhancements/route_concerns.rb +0 -56
  168. data/lib/linked_rails/enhancements/singularable/controller.rb +0 -43
  169. data/lib/linked_rails/enhancements/singularable/model.rb +0 -47
  170. data/lib/linked_rails/enhancements/singularable/serializer.rb +0 -28
  171. data/lib/linked_rails/enhancements/tableable/model.rb +0 -28
  172. data/lib/linked_rails/enhancements/updatable/action.rb +0 -15
  173. data/lib/linked_rails/enhancements/updatable/routing.rb +0 -20
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: linked_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4.pre.g14b377f91
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arthur Dingemans
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-26 00:00:00.000000000 Z
11
+ date: 2022-08-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_response
@@ -24,6 +24,20 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 0.0.2
27
+ - !ruby/object:Gem::Dependency
28
+ name: emp_json
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 1.3.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: 1.3.0
27
41
  - !ruby/object:Gem::Dependency
28
42
  name: kaminari-activerecord
29
43
  requirement: !ruby/object:Gem::Requirement
@@ -52,6 +66,20 @@ dependencies:
52
66
  - - ">="
53
67
  - !ruby/object:Gem::Version
54
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: redis
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
55
83
  - !ruby/object:Gem::Dependency
56
84
  name: rdf
57
85
  requirement: !ruby/object:Gem::Requirement
@@ -72,14 +100,14 @@ dependencies:
72
100
  requirements:
73
101
  - - "~>"
74
102
  - !ruby/object:Gem::Version
75
- version: 0.0.9
103
+ version: 0.0.10
76
104
  type: :runtime
77
105
  prerelease: false
78
106
  version_requirements: !ruby/object:Gem::Requirement
79
107
  requirements:
80
108
  - - "~>"
81
109
  - !ruby/object:Gem::Version
82
- version: 0.0.9
110
+ version: 0.0.10
83
111
  - !ruby/object:Gem::Dependency
84
112
  name: rdf-vocab
85
113
  requirement: !ruby/object:Gem::Requirement
@@ -178,7 +206,7 @@ dependencies:
178
206
  - - ">="
179
207
  - !ruby/object:Gem::Version
180
208
  version: '0'
181
- description:
209
+ description:
182
210
  email:
183
211
  - arthur@argu.co
184
212
  executables: []
@@ -189,6 +217,7 @@ files:
189
217
  - README.md
190
218
  - Rakefile
191
219
  - app/controllers/linked_rails/actions/items_controller.rb
220
+ - app/controllers/linked_rails/actions/objects_controller.rb
192
221
  - app/controllers/linked_rails/bulk_controller.rb
193
222
  - app/controllers/linked_rails/current_user_controller.rb
194
223
  - app/controllers/linked_rails/enum_values_controller.rb
@@ -198,20 +227,20 @@ files:
198
227
  - app/controllers/linked_rails/menus/lists_controller.rb
199
228
  - app/controllers/linked_rails/not_found_controller.rb
200
229
  - app/controllers/linked_rails/ontologies_controller.rb
201
- - app/models/linked_rails/actions/default_actions.rb
202
- - app/models/linked_rails/actions/default_actions/create.rb
203
- - app/models/linked_rails/actions/default_actions/destroy.rb
204
- - app/models/linked_rails/actions/default_actions/update.rb
205
230
  - app/models/linked_rails/actions/item.rb
206
231
  - app/models/linked_rails/actions/list.rb
232
+ - app/models/linked_rails/actions/object.rb
207
233
  - app/models/linked_rails/collection.rb
234
+ - app/models/linked_rails/collection/configuration.rb
208
235
  - app/models/linked_rails/collection/filter.rb
209
236
  - app/models/linked_rails/collection/filter_field.rb
210
237
  - app/models/linked_rails/collection/filter_option.rb
211
238
  - app/models/linked_rails/collection/filterable.rb
239
+ - app/models/linked_rails/collection/infinite.rb
212
240
  - app/models/linked_rails/collection/infinite_view.rb
213
241
  - app/models/linked_rails/collection/iri.rb
214
242
  - app/models/linked_rails/collection/iri_mapping.rb
243
+ - app/models/linked_rails/collection/paginated.rb
215
244
  - app/models/linked_rails/collection/paginated_view.rb
216
245
  - app/models/linked_rails/collection/sortable.rb
217
246
  - app/models/linked_rails/collection/sorting.rb
@@ -243,6 +272,7 @@ files:
243
272
  - app/models/linked_rails/form/field/text_area_input.rb
244
273
  - app/models/linked_rails/form/field/text_input.rb
245
274
  - app/models/linked_rails/form/field/toggle_button_group.rb
275
+ - app/models/linked_rails/form/field/url_input.rb
246
276
  - app/models/linked_rails/form/field_factory.rb
247
277
  - app/models/linked_rails/form/group.rb
248
278
  - app/models/linked_rails/form/page.rb
@@ -265,6 +295,7 @@ files:
265
295
  - app/models/linked_rails/widget.rb
266
296
  - app/policies/linked_rails/actions/item_policy.rb
267
297
  - app/policies/linked_rails/actions/list_policy.rb
298
+ - app/policies/linked_rails/actions/object_policy.rb
268
299
  - app/policies/linked_rails/collection/view_policy.rb
269
300
  - app/policies/linked_rails/collection_policy.rb
270
301
  - app/policies/linked_rails/enum_value_policy.rb
@@ -272,6 +303,7 @@ files:
272
303
  - app/policies/linked_rails/menus/list_policy.rb
273
304
  - app/policies/linked_rails/sequence_policy.rb
274
305
  - app/serializers/linked_rails/actions/item_serializer.rb
306
+ - app/serializers/linked_rails/actions/object_serializer.rb
275
307
  - app/serializers/linked_rails/collection/filter_field_serializer.rb
276
308
  - app/serializers/linked_rails/collection/filter_option_serializer.rb
277
309
  - app/serializers/linked_rails/collection/filter_serializer.rb
@@ -284,6 +316,7 @@ files:
284
316
  - app/serializers/linked_rails/entry_point_serializer.rb
285
317
  - app/serializers/linked_rails/enum_value_serializer.rb
286
318
  - app/serializers/linked_rails/form/field/association_input_serializer.rb
319
+ - app/serializers/linked_rails/form/field/file_input_serializer.rb
287
320
  - app/serializers/linked_rails/form/field/resource_field_serializer.rb
288
321
  - app/serializers/linked_rails/form/field/select_input_serializer.rb
289
322
  - app/serializers/linked_rails/form/field_serializer.rb
@@ -296,6 +329,7 @@ files:
296
329
  - app/serializers/linked_rails/ontology/class_serializer.rb
297
330
  - app/serializers/linked_rails/ontology/property_serializer.rb
298
331
  - app/serializers/linked_rails/ontology_serializer.rb
332
+ - app/serializers/linked_rails/property_query_serializer.rb
299
333
  - app/serializers/linked_rails/rdf_error_serializer.rb
300
334
  - app/serializers/linked_rails/sequence_serializer.rb
301
335
  - app/serializers/linked_rails/shacl/node_shape_serializer.rb
@@ -308,7 +342,6 @@ files:
308
342
  - lib/generators/linked_rails/install/install_generator.rb
309
343
  - lib/generators/linked_rails/install/templates/README
310
344
  - lib/generators/linked_rails/install/templates/app_menu_list.rb
311
- - lib/generators/linked_rails/install/templates/application_action_list.rb
312
345
  - lib/generators/linked_rails/install/templates/application_form.rb
313
346
  - lib/generators/linked_rails/install/templates/application_menu_list.rb
314
347
  - lib/generators/linked_rails/install/templates/application_policy.rb
@@ -320,7 +353,6 @@ files:
320
353
  - lib/generators/linked_rails/install/templates/vocab.rb
321
354
  - lib/generators/linked_rails/install/templates/vocab.yml
322
355
  - lib/generators/linked_rails/model/model_generator.rb
323
- - lib/generators/linked_rails/model/templates/action_list.rb.tt
324
356
  - lib/generators/linked_rails/model/templates/controller.rb.tt
325
357
  - lib/generators/linked_rails/model/templates/create_table_migration.rb.tt
326
358
  - lib/generators/linked_rails/model/templates/form.rb.tt
@@ -337,38 +369,32 @@ files:
337
369
  - lib/linked_rails/active_response/responders/rdf.rb
338
370
  - lib/linked_rails/cache.rb
339
371
  - lib/linked_rails/callable_variable.rb
372
+ - lib/linked_rails/collection_params_parser.rb
340
373
  - lib/linked_rails/constraints/whitelist.rb
341
374
  - lib/linked_rails/controller.rb
375
+ - lib/linked_rails/controller/actionable.rb
342
376
  - lib/linked_rails/controller/authorization.rb
377
+ - lib/linked_rails/controller/default_actions/create.rb
378
+ - lib/linked_rails/controller/default_actions/destroy.rb
379
+ - lib/linked_rails/controller/default_actions/update.rb
380
+ - lib/linked_rails/controller/delta.rb
343
381
  - lib/linked_rails/controller/error_handling.rb
382
+ - lib/linked_rails/controller/rendering.rb
344
383
  - lib/linked_rails/engine.rb
345
384
  - lib/linked_rails/enhanceable.rb
346
385
  - lib/linked_rails/enhancements.rb
347
- - lib/linked_rails/enhancements/actionable/model.rb
348
- - lib/linked_rails/enhancements/actionable/serializer.rb
349
- - lib/linked_rails/enhancements/creatable/action.rb
350
386
  - lib/linked_rails/enhancements/creatable/controller.rb
351
- - lib/linked_rails/enhancements/destroyable/action.rb
352
387
  - lib/linked_rails/enhancements/destroyable/controller.rb
353
- - lib/linked_rails/enhancements/destroyable/routing.rb
354
- - lib/linked_rails/enhancements/indexable/model.rb
355
- - lib/linked_rails/enhancements/menuable/model.rb
356
- - lib/linked_rails/enhancements/menuable/serializer.rb
357
- - lib/linked_rails/enhancements/route_concerns.rb
358
- - lib/linked_rails/enhancements/singularable/controller.rb
359
- - lib/linked_rails/enhancements/singularable/model.rb
360
- - lib/linked_rails/enhancements/singularable/serializer.rb
361
- - lib/linked_rails/enhancements/tableable/model.rb
362
- - lib/linked_rails/enhancements/updatable/action.rb
363
388
  - lib/linked_rails/enhancements/updatable/controller.rb
364
- - lib/linked_rails/enhancements/updatable/routing.rb
365
389
  - lib/linked_rails/enhancements/updatable/serializer.rb
366
390
  - lib/linked_rails/helpers/delta_helper.rb
367
391
  - lib/linked_rails/helpers/ontola_actions_helper.rb
368
392
  - lib/linked_rails/helpers/resource_helper.rb
369
393
  - lib/linked_rails/iri_mapper.rb
394
+ - lib/linked_rails/middleware/error_handling.rb
370
395
  - lib/linked_rails/middleware/linked_data_params.rb
371
396
  - lib/linked_rails/model.rb
397
+ - lib/linked_rails/model/actionable.rb
372
398
  - lib/linked_rails/model/collections.rb
373
399
  - lib/linked_rails/model/dirty.rb
374
400
  - lib/linked_rails/model/enhancements.rb
@@ -376,26 +402,38 @@ files:
376
402
  - lib/linked_rails/model/indexable.rb
377
403
  - lib/linked_rails/model/iri.rb
378
404
  - lib/linked_rails/model/iri_mapping.rb
405
+ - lib/linked_rails/model/menuable.rb
379
406
  - lib/linked_rails/model/serialization.rb
407
+ - lib/linked_rails/model/singularable.rb
380
408
  - lib/linked_rails/model/sorting.rb
409
+ - lib/linked_rails/model/tables.rb
381
410
  - lib/linked_rails/params_parser.rb
382
411
  - lib/linked_rails/policy.rb
383
412
  - lib/linked_rails/policy/attribute_conditions.rb
413
+ - lib/linked_rails/railtie.rb
384
414
  - lib/linked_rails/rdf_error.rb
385
415
  - lib/linked_rails/renderers.rb
386
416
  - lib/linked_rails/routes.rb
387
417
  - lib/linked_rails/serializer.rb
418
+ - lib/linked_rails/serializer/actionable.rb
419
+ - lib/linked_rails/serializer/menuable.rb
420
+ - lib/linked_rails/serializer/singularable.rb
421
+ - lib/linked_rails/test_methods.rb
388
422
  - lib/linked_rails/translate.rb
423
+ - lib/linked_rails/types/iri_type.rb
424
+ - lib/linked_rails/uri_template.rb
389
425
  - lib/linked_rails/version.rb
390
426
  - lib/linked_rails/vocab.rb
391
427
  - lib/nill_class_renderer.rb
392
428
  - lib/rails/welcome_controller.rb
429
+ - lib/rdf/list.rb
430
+ - lib/rdf/query_fix.rb
393
431
  - lib/tasks/linked_rails_tasks.rake
394
432
  homepage: https://github.com/ontola/linked_rails
395
433
  licenses:
396
- - GPL-3.0-or-later
434
+ - MIT
397
435
  metadata: {}
398
- post_install_message:
436
+ post_install_message:
399
437
  rdoc_options: []
400
438
  require_paths:
401
439
  - lib
@@ -406,12 +444,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
406
444
  version: '0'
407
445
  required_rubygems_version: !ruby/object:Gem::Requirement
408
446
  requirements:
409
- - - ">="
447
+ - - ">"
410
448
  - !ruby/object:Gem::Version
411
- version: '0'
449
+ version: 1.3.1
412
450
  requirements: []
413
- rubygems_version: 3.1.2
414
- signing_key:
451
+ rubygems_version: 3.3.7
452
+ signing_key:
415
453
  specification_version: 4
416
454
  summary: LinkedRails helps you create a Linked Data application in a matter of seconds.
417
455
  test_files: []
@@ -1,60 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module LinkedRails
4
- module Actions
5
- module DefaultActions
6
- module Create
7
- def has_collection_create_action(overwrite = {}) # rubocop:disable Naming/PredicateName
8
- has_collection_action(:create, create_collection_options(overwrite))
9
- end
10
-
11
- def has_singular_create_action(overwrite = {}) # rubocop:disable Naming/PredicateName
12
- has_singular_action(:create, create_singular_options(overwrite))
13
- end
14
-
15
- private
16
-
17
- def create_collection_options(overwrite = {})
18
- default_create_options(
19
- form: -> { resource.association_class.try(:form_class) },
20
- object: -> { resource.build_child },
21
- policy: :create_child?
22
- ).merge(overwrite)
23
- end
24
-
25
- def create_singular_options(overwrite = {})
26
- default_create_options(
27
- form: -> { resource.class.try(:form_class) },
28
- object: -> { resource },
29
- policy: :create?,
30
- url: -> { resource.singular_iri }
31
- ).merge(overwrite)
32
- end
33
-
34
- def default_create_options(overwrite = {}) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
35
- {
36
- http_method: :post,
37
- image: 'fa-plus',
38
- label: lambda do
39
- item = LinkedRails::Actions::Item.new(resource: result_class.new, tag: :create)
40
- LinkedRails.translate(:action, :label, item, false).presence ||
41
- I18n.t("#{association}.type_new", default: "New #{result_class.name.demodulize.humanize}")
42
- end,
43
- root_relative_iri: lambda {
44
- uri = resource.root_relative_iri.dup
45
- uri.path ||= ''
46
- uri.path += '/new'
47
- uri.query = Rack::Utils.parse_nested_query(uri.query).except('display', 'sort').to_param.presence
48
- uri.to_s
49
- },
50
- result: -> { result_class },
51
- type: lambda {
52
- [Vocab.ontola["Create::#{result_class}"], Vocab.schema.CreateAction]
53
- },
54
- url: -> { resource.iri }
55
- }.merge(overwrite)
56
- end
57
- end
58
- end
59
- end
60
- end
@@ -1,45 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module LinkedRails
4
- module Actions
5
- module DefaultActions
6
- module Destroy
7
- def has_resource_destroy_action(overwrite = {}) # rubocop:disable Naming/PredicateName
8
- has_resource_action(:destroy, destroy_resource_options(overwrite))
9
- end
10
-
11
- def has_singular_destroy_action(overwrite = {}) # rubocop:disable Naming/PredicateName
12
- has_singular_action(:destroy, destroy_singular_options(overwrite))
13
- end
14
-
15
- private
16
-
17
- def destroy_resource_options(overwrite = {})
18
- default_destroy_options(overwrite)
19
- end
20
-
21
- def destroy_singular_options(overwrite = {})
22
- default_destroy_options(
23
- url: -> { resource.singular_iri }
24
- ).merge(overwrite)
25
- end
26
-
27
- def default_destroy_options(overwrite = {}) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
28
- {
29
- http_method: :delete,
30
- image: 'fa-close',
31
- policy: :destroy?,
32
- root_relative_iri: lambda {
33
- uri = resource.root_relative_iri.dup
34
- uri.path ||= ''
35
- uri.path += '/delete'
36
- uri.to_s
37
- },
38
- type: [Vocab.schema.Action, Vocab.ontola[:DestroyAction]],
39
- url: -> { resource.iri(destroy: true) }
40
- }.merge(overwrite)
41
- end
42
- end
43
- end
44
- end
45
- end
@@ -1,50 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module LinkedRails
4
- module Actions
5
- module DefaultActions
6
- module Update
7
- def has_resource_update_action(overwrite = {}) # rubocop:disable Naming/PredicateName
8
- has_resource_action(:update, update_resource_options(overwrite))
9
- end
10
-
11
- def has_singular_update_action(overwrite = {}) # rubocop:disable Naming/PredicateName
12
- has_singular_action(:update, update_singular_options(overwrite))
13
- end
14
-
15
- private
16
-
17
- def update_resource_options(overwrite = {})
18
- default_update_options(overwrite)
19
- end
20
-
21
- def update_singular_options(overwrite = {})
22
- default_update_options(
23
- url: -> { resource.singular_iri }
24
- ).merge(overwrite)
25
- end
26
-
27
- def default_update_options(overwrite = {}) # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
28
- {
29
- form: -> { resource.class.try(:form_class) },
30
- http_method: :put,
31
- image: 'fa-pencil-square-o',
32
- label: lambda {
33
- type = I18n.t("#{resource.class.name.tableize}.type", default: nil)
34
- type.present? ? I18n.t('edit_type', type: type) : I18n.t('update')
35
- },
36
- policy: :update?,
37
- root_relative_iri: lambda {
38
- uri = resource.root_relative_iri.dup
39
- uri.path ||= ''
40
- uri.path += '/edit'
41
- uri.to_s
42
- },
43
- type: Vocab.schema.UpdateAction,
44
- url: -> { resource.iri }
45
- }.merge(overwrite)
46
- end
47
- end
48
- end
49
- end
50
- end
@@ -1,17 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require_relative 'default_actions/create'
4
-
5
- module LinkedRails
6
- module Actions
7
- module DefaultActions
8
- extend ActiveSupport::Concern
9
-
10
- included do
11
- extend LinkedRails::Actions::DefaultActions::Create
12
- extend LinkedRails::Actions::DefaultActions::Destroy
13
- extend LinkedRails::Actions::DefaultActions::Update
14
- end
15
- end
16
- end
17
- end
@@ -1,3 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- class ApplicationActionList < LinkedRails::Actions::List; end
@@ -1,6 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- <% module_namespacing do -%>
4
- class <%= class_name %>ActionList < ApplicationActionList
5
- end
6
- <% end -%>
@@ -1,71 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module LinkedRails
4
- module Enhancements
5
- module Actionable
6
- module Model
7
- extend ActiveSupport::Concern
8
-
9
- def actions(user_context = nil)
10
- action_list(user_context).actions
11
- end
12
-
13
- def action(tag, user_context = nil)
14
- actions(user_context).find { |a| a.tag == tag }
15
- end
16
-
17
- def action_list(user_context)
18
- @action_list ||= {}
19
- @action_list[user_context] ||= self.class.action_list.new(resource: self, user_context: user_context)
20
- end
21
-
22
- def action_triples
23
- @action_triples ||= triples_for_actions(actions) + triples_for_actions(collection_actions)
24
- end
25
-
26
- def collection_actions
27
- (try(:collections) || []).map do |opts|
28
- collection_for(opts[:name]).actions
29
- end.flatten
30
- end
31
-
32
- private
33
-
34
- def triples_for_actions(actions)
35
- actions.flat_map do |action|
36
- triples = [
37
- [iri, action.predicate, action.iri],
38
- [iri, Vocab.schema.potentialAction, action.iri]
39
- ]
40
- triples << [iri, LinkedRails::Vocab.ontola[:favoriteAction], action.iri] if action.favorite
41
- triples
42
- end
43
- end
44
-
45
- module ClassMethods
46
- def action_list
47
- return @action_list if @action_list.try(:actionable_class) == self
48
-
49
- @action_list = defined_action_list || define_action_list
50
- end
51
-
52
- private
53
-
54
- def action_superclass
55
- superclass.try(:action_list) || LinkedRails.action_list_parent_class
56
- end
57
-
58
- def defined_action_list
59
- "#{name}ActionList".safe_constantize
60
- end
61
-
62
- def define_action_list
63
- list = const_set("#{name.demodulize}ActionList", Class.new(action_superclass))
64
- list.include_enhancements(:actionable_class, :Action)
65
- list
66
- end
67
- end
68
- end
69
- end
70
- end
71
- end
@@ -1,25 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module LinkedRails
4
- module Enhancements
5
- module Actionable
6
- module Serializer
7
- extend ActiveSupport::Concern
8
-
9
- included do
10
- statements :action_triples
11
- end
12
-
13
- class_methods do
14
- def action_triples(object, _params)
15
- if object.iri.anonymous? && !object.singular_resource?
16
- []
17
- else
18
- object.action_triples
19
- end
20
- end
21
- end
22
- end
23
- end
24
- end
25
- end
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module LinkedRails
4
- module Enhancements
5
- module Creatable
6
- module Action
7
- extend ActiveSupport::Concern
8
-
9
- included do
10
- has_collection_create_action
11
- end
12
- end
13
- end
14
- end
15
- end
@@ -1,15 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module LinkedRails
4
- module Enhancements
5
- module Destroyable
6
- module Action
7
- extend ActiveSupport::Concern
8
-
9
- included do
10
- has_resource_destroy_action
11
- end
12
- end
13
- end
14
- end
15
- end
@@ -1,19 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module LinkedRails
4
- module Enhancements
5
- module Destroyable
6
- module Routing; end
7
-
8
- class << self
9
- def route_concerns(mapper)
10
- mapper.concern :destroyable do
11
- mapper.member do
12
- mapper.delete '', action: :destroy
13
- end
14
- end
15
- end
16
- end
17
- end
18
- end
19
- end
@@ -1,36 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module LinkedRails
4
- module Enhancements
5
- module Menuable
6
- module Model
7
- extend ActiveSupport::Concern
8
-
9
- def menus(user_context = nil)
10
- menu_list(user_context).menus
11
- end
12
-
13
- def menu(tag, user_context = nil)
14
- menu_list(user_context).menu(tag)
15
- end
16
-
17
- def menu_list(user_context = nil)
18
- @menu_list = {}
19
- @menu_list[user_context] ||= self.class.menu_class.new(resource: self, user_context: user_context)
20
- end
21
-
22
- module ClassMethods
23
- def menu_class
24
- @menu_class ||= "#{name}MenuList".safe_constantize || "#{superclass.name}MenuList".safe_constantize
25
- end
26
-
27
- def preview_includes
28
- return super if menu_class.blank?
29
-
30
- super + menu_class.defined_menus.keys.map { |tag| "#{tag}_menu" }
31
- end
32
- end
33
- end
34
- end
35
- end
36
- end
@@ -1,33 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module LinkedRails
4
- module Enhancements
5
- module Menuable
6
- module Serializer
7
- extend ActiveSupport::Concern
8
-
9
- included do
10
- include_menus
11
- end
12
-
13
- module ClassMethods
14
- def inherited(target)
15
- super
16
- target.include_menus
17
- end
18
-
19
- def include_menus
20
- serializable_class.try(:menu_class)&.defined_menus&.keys&.each do |menu|
21
- has_one "#{menu}_menu",
22
- predicate: Vocab.ontola["#{menu.to_s.camelize(:lower)}Menu"],
23
- if: method(:named_object?),
24
- polymorphic: true do |object, opts|
25
- object.menu(menu, opts[:scope])
26
- end
27
- end
28
- end
29
- end
30
- end
31
- end
32
- end
33
- end