forest_liana 2.15.8 → 3.0.0.pre.beta.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +1 -1
  3. data/app/controllers/forest_liana/resources_controller.rb +9 -17
  4. data/app/controllers/forest_liana/stats_controller.rb +4 -14
  5. data/app/models/forest_liana/model/action.rb +57 -3
  6. data/app/models/forest_liana/model/collection.rb +37 -9
  7. data/app/models/forest_liana/model/segment.rb +1 -1
  8. data/app/serializers/forest_liana/schema_serializer.rb +83 -0
  9. data/app/serializers/forest_liana/serializer_factory.rb +13 -48
  10. data/app/services/forest_liana/apimap_sorter.rb +88 -48
  11. data/app/services/forest_liana/base_getter.rb +1 -7
  12. data/app/services/forest_liana/has_many_getter.rb +14 -15
  13. data/app/services/forest_liana/line_stat_getter.rb +5 -1
  14. data/app/services/forest_liana/operator_value_parser.rb +1 -46
  15. data/app/services/forest_liana/pie_stat_getter.rb +2 -2
  16. data/app/services/forest_liana/query_stat_getter.rb +3 -25
  17. data/app/services/forest_liana/resource_getter.rb +8 -2
  18. data/app/services/forest_liana/resources_getter.rb +13 -27
  19. data/app/services/forest_liana/schema_adapter.rb +65 -64
  20. data/app/services/forest_liana/search_query_builder.rb +24 -5
  21. data/app/services/forest_liana/stat_getter.rb +8 -1
  22. data/app/services/forest_liana/value_stat_getter.rb +2 -2
  23. data/lib/forest_liana.rb +2 -0
  24. data/lib/forest_liana/bootstraper.rb +119 -122
  25. data/lib/forest_liana/collection.rb +41 -12
  26. data/lib/forest_liana/engine.rb +16 -11
  27. data/lib/forest_liana/json_printer.rb +54 -0
  28. data/lib/forest_liana/schema_file_updater.rb +141 -0
  29. data/lib/forest_liana/version.rb +1 -1
  30. data/test/dummy/config/routes.rb +1 -0
  31. data/test/dummy/db/test.sqlite3 +0 -0
  32. data/test/dummy/log/test.log +116056 -3826
  33. data/test/integration/navigation_test.rb +10 -0
  34. data/test/routing/route_test.rb +2 -0
  35. data/test/services/forest_liana/resources_getter_test.rb +3 -3
  36. data/test/services/forest_liana/schema_adapter_test.rb +50 -49
  37. metadata +11 -111
  38. data/app/helpers/forest_liana/query_helper.rb +0 -30
  39. data/app/helpers/forest_liana/schema_helper.rb +0 -8
  40. data/app/serializers/forest_liana/action_serializer.rb +0 -21
  41. data/app/serializers/forest_liana/collection_serializer.rb +0 -33
  42. data/app/serializers/forest_liana/segment_serializer.rb +0 -15
  43. data/app/services/forest_liana/leaderboard_stat_getter.rb +0 -44
  44. data/app/services/forest_liana/objective_stat_getter.rb +0 -10
  45. data/spec/dummy/README.rdoc +0 -28
  46. data/spec/dummy/Rakefile +0 -6
  47. data/spec/dummy/app/assets/javascripts/application.js +0 -13
  48. data/spec/dummy/app/assets/stylesheets/application.css +0 -15
  49. data/spec/dummy/app/config/routes.rb +0 -3
  50. data/spec/dummy/app/controllers/application_controller.rb +0 -5
  51. data/spec/dummy/app/helpers/application_helper.rb +0 -2
  52. data/spec/dummy/app/models/island.rb +0 -5
  53. data/spec/dummy/app/models/tree.rb +0 -5
  54. data/spec/dummy/app/models/user.rb +0 -4
  55. data/spec/dummy/app/views/layouts/application.html.erb +0 -14
  56. data/spec/dummy/bin/bundle +0 -3
  57. data/spec/dummy/bin/rails +0 -4
  58. data/spec/dummy/bin/rake +0 -4
  59. data/spec/dummy/bin/setup +0 -29
  60. data/spec/dummy/config.ru +0 -4
  61. data/spec/dummy/config/application.rb +0 -26
  62. data/spec/dummy/config/boot.rb +0 -5
  63. data/spec/dummy/config/database.yml +0 -25
  64. data/spec/dummy/config/environment.rb +0 -5
  65. data/spec/dummy/config/environments/development.rb +0 -41
  66. data/spec/dummy/config/environments/production.rb +0 -79
  67. data/spec/dummy/config/environments/test.rb +0 -42
  68. data/spec/dummy/config/initializers/assets.rb +0 -11
  69. data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
  70. data/spec/dummy/config/initializers/cookies_serializer.rb +0 -3
  71. data/spec/dummy/config/initializers/filter_parameter_logging.rb +0 -4
  72. data/spec/dummy/config/initializers/forest_liana.rb +0 -2
  73. data/spec/dummy/config/initializers/inflections.rb +0 -16
  74. data/spec/dummy/config/initializers/mime_types.rb +0 -4
  75. data/spec/dummy/config/initializers/session_store.rb +0 -3
  76. data/spec/dummy/config/initializers/wrap_parameters.rb +0 -14
  77. data/spec/dummy/config/routes.rb +0 -3
  78. data/spec/dummy/config/secrets.yml +0 -22
  79. data/spec/dummy/db/migrate/20190226172951_create_user.rb +0 -9
  80. data/spec/dummy/db/migrate/20190226173051_create_isle.rb +0 -10
  81. data/spec/dummy/db/migrate/20190226174951_create_tree.rb +0 -12
  82. data/spec/dummy/db/schema.rb +0 -42
  83. data/spec/dummy/db/test.sqlite3 +0 -0
  84. data/spec/dummy/log/development.log +0 -80
  85. data/spec/dummy/log/test.log +0 -26139
  86. data/spec/helpers/forest_liana/query_helper_spec.rb +0 -74
  87. data/spec/helpers/forest_liana/schema_helper_spec.rb +0 -13
  88. data/spec/rails_helper.rb +0 -61
  89. data/spec/requests/resources_spec.rb +0 -97
  90. data/spec/services/forest_liana/apimap_sorter_spec.rb +0 -172
  91. data/spec/services/forest_liana/ip_whitelist_checker_spec.rb +0 -203
  92. data/spec/services/forest_liana/schema_adapter_spec.rb +0 -17
  93. data/spec/spec_helper.rb +0 -99
@@ -0,0 +1,10 @@
1
+ require 'test_helper'
2
+
3
+ class NavigationTest < ActionDispatch::IntegrationTest
4
+ fixtures :all
5
+
6
+ # test "the truth" do
7
+ # assert true
8
+ # end
9
+ end
10
+
@@ -1,3 +1,5 @@
1
+ #require 'rails_helper'
2
+
1
3
  module ForestLiana
2
4
  class RouteTest < ActiveSupport::TestCase
3
5
  include ActionDispatch::Assertions::RoutingAssertions
@@ -140,7 +140,7 @@ module ForestLiana
140
140
  assert records.first.owner.name == 'Arnaud Besnier'
141
141
  end
142
142
 
143
- test 'Filter after x days' do
143
+ test 'Filter after x hours' do
144
144
  getter = ResourcesGetter.new(Tree, {
145
145
  fields: { 'Tree' => 'id' },
146
146
  page: { size: 10, number: 1 },
@@ -228,7 +228,7 @@ module ForestLiana
228
228
 
229
229
  test 'Filter on a field of an associated collection that does not exist' do
230
230
  exception = assert_raises(ForestLiana::Errors::HTTP422Error) {
231
- getter = ForestLiana::ResourcesGetter.new(Tree, {
231
+ ForestLiana::ResourcesGetter.new(Tree, {
232
232
  fields: { 'Tree' => 'id'},
233
233
  filterType: 'and',
234
234
  searchExtended: '0',
@@ -242,7 +242,7 @@ module ForestLiana
242
242
 
243
243
  test 'Filter on a field that does not exists' do
244
244
  exception = assert_raises(ForestLiana::Errors::HTTP422Error) {
245
- getter = ForestLiana::ResourcesGetter.new(Tree, {
245
+ ForestLiana::ResourcesGetter.new(Tree, {
246
246
  fields: { 'Tree' => 'id'},
247
247
  filterType: 'and',
248
248
  searchExtended: '0',
@@ -2,95 +2,96 @@ module ForestLiana
2
2
  class SchemaAdapterTest < ActiveSupport::TestCase
3
3
  test 'Date should have the type `Date`' do
4
4
  schema = SchemaAdapter.new(DateField).perform
5
- assert schema.fields.include?({ field: 'field', type: 'Date' })
6
- end
7
-
8
- test 'DateTime should have the type `Date`' do
9
- schema = SchemaAdapter.new(DateField).perform
10
- assert schema.fields.include?({ field: 'field', type: 'Date' })
5
+ fields = schema.fields.select { |field| field[:field] == 'field' } #&& field[:type] == 'Date' }
6
+ assert fields.size == 1
11
7
  end
12
8
 
13
9
  test 'Integer should have the type `Number`' do
14
10
  schema = SchemaAdapter.new(IntegerField).perform
15
- assert schema.fields.include?({ field: 'field', type: 'Number' })
11
+ fields = schema.fields.select { |field| field[:field] == 'field' && field[:type] == 'Number' }
12
+ assert fields.size == 1
16
13
  end
17
14
 
18
15
  test 'Float should have the type `Number`' do
19
16
  schema = SchemaAdapter.new(FloatField).perform
20
- assert schema.fields.include?({ field: 'field', type: 'Number' })
17
+ fields = schema.fields.select { |field| field[:field] == 'field' && field[:type] == 'Number' }
18
+ assert fields.size == 1
21
19
  end
22
20
 
23
21
  test 'Decimal should have the type `Number`' do
24
22
  schema = SchemaAdapter.new(DecimalField).perform
25
- assert schema.fields.include?({ field: 'field', type: 'Number' })
23
+ fields = schema.fields.select { |field| field[:field] == 'field' && field[:type] == 'Number' }
24
+ assert fields.size == 1
26
25
  end
27
26
 
28
27
  test 'Boolean should have the type `Boolean`' do
29
28
  schema = SchemaAdapter.new(BooleanField).perform
30
- assert schema.fields.include?({ field: 'field', type: 'Boolean' })
29
+ fields = schema.fields.select { |field| field[:field] == 'field' && field[:type] == 'Boolean' }
30
+ assert fields.size == 1
31
31
  end
32
32
 
33
33
  test 'String should have the type `String`' do
34
34
  schema = SchemaAdapter.new(StringField).perform
35
- assert schema.fields.include?({ field: 'field', type: 'String' })
35
+ fields = schema.fields.select { |field| field[:field] == 'field' && field[:type] == 'String' }
36
+ assert fields.size == 1
36
37
  end
37
38
 
38
39
  test 'belongsTo relationship' do
39
40
  schema = SchemaAdapter.new(BelongsToField).perform
40
- assert schema.fields.include?({
41
- field: :has_one_field,
42
- type: 'Number',
43
- relationship: 'BelongsTo',
44
- reference: 'HasOneField.id',
45
- inverseOf: 'belongs_to_field'
46
- })
41
+ fields = schema.fields.select do |field|
42
+ field[:field] == :has_one_field &&
43
+ field[:type] == 'Number' &&
44
+ field[:reference] == 'HasOneField.id' &&
45
+ field[:inverse_of] == 'belongs_to_field'
46
+ end
47
+ assert fields.size == 1
47
48
  end
48
49
 
49
50
  test 'hasOne relationship' do
50
51
  schema = SchemaAdapter.new(HasOneField).perform
51
- assert schema.fields.include?({
52
- field: 'belongs_to_field',
53
- type: 'Number',
54
- relationship: 'HasOne',
55
- reference: 'BelongsToField.id',
56
- inverseOf: 'has_one_field',
57
- "is-filterable": true
58
- })
52
+ fields = schema.fields.select do |field|
53
+ field[:field] == 'belongs_to_field' &&
54
+ field[:type] == 'Number' &&
55
+ field[:reference] == 'BelongsToField.id' &&
56
+ field[:inverse_of] == 'has_one_field' &&
57
+ field[:is_filterable] == true
58
+ end
59
+ assert fields.size == 1
59
60
  end
60
61
 
61
62
  test 'hasMany relationship' do
62
63
  schema = SchemaAdapter.new(HasManyField).perform
63
- assert schema.fields.include?({
64
- field: 'belongs_to_fields',
65
- type: ['Number'],
66
- relationship: 'HasMany',
67
- reference: 'BelongsToField.id',
68
- inverseOf: 'has_many_field',
69
- "is-filterable": false
70
- })
64
+ fields = schema.fields.select do |field|
65
+ field[:field] == 'belongs_to_fields' &&
66
+ field[:type] == ['Number'] &&
67
+ field[:reference] == 'BelongsToField.id' &&
68
+ field[:inverse_of] == 'has_many_field' &&
69
+ field[:is_filterable] == false
70
+ end
71
+ assert fields.size == 1
71
72
  end
72
73
 
73
74
  test 'hasMany relationhip with specified class_name' do
74
75
  schema = SchemaAdapter.new(HasManyClassNameField).perform
75
- assert schema.fields.include?({
76
- field: 'foo',
77
- type: ['Number'],
78
- relationship: 'HasMany',
79
- reference: 'BelongsToField.id',
80
- inverseOf: 'has_many_class_name_field',
81
- "is-filterable": false
82
- })
76
+ fields = schema.fields.select do |field|
77
+ field[:field] == 'foo' &&
78
+ field[:type] == ['Number'] &&
79
+ field[:reference] == 'BelongsToField.id' &&
80
+ field[:inverse_of] == 'has_many_class_name_field' &&
81
+ field[:is_filterable] == false
82
+ end
83
+ assert fields.size == 1
83
84
  end
84
85
 
85
86
  test 'belongsTo relationhip with specified class_name' do
86
87
  schema = SchemaAdapter.new(BelongsToClassNameField).perform
87
- assert schema.fields.include?({
88
- field: :foo,
89
- type: 'Number',
90
- relationship: 'BelongsTo',
91
- reference: 'HasOneField.id',
92
- inverseOf: 'belongs_to_class_name_field'
93
- })
88
+ fields = schema.fields.select do |field|
89
+ field[:field] == :foo &&
90
+ field[:type] == 'Number' &&
91
+ field[:reference] == 'HasOneField.id' &&
92
+ field[:inverse_of] == 'belongs_to_class_name_field'
93
+ end
94
+ assert fields.size == 1
94
95
  end
95
96
 
96
97
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: forest_liana
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.15.8
4
+ version: 3.0.0.pre.beta.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sandro Munda
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-03-01 00:00:00.000000000 Z
11
+ date: 2019-01-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -210,18 +210,14 @@ files:
210
210
  - app/helpers/forest_liana/adapter_helper.rb
211
211
  - app/helpers/forest_liana/application_helper.rb
212
212
  - app/helpers/forest_liana/decoration_helper.rb
213
- - app/helpers/forest_liana/query_helper.rb
214
- - app/helpers/forest_liana/schema_helper.rb
215
213
  - app/models/forest_liana/model/action.rb
216
214
  - app/models/forest_liana/model/collection.rb
217
215
  - app/models/forest_liana/model/segment.rb
218
216
  - app/models/forest_liana/model/stat.rb
219
- - app/serializers/forest_liana/action_serializer.rb
220
- - app/serializers/forest_liana/collection_serializer.rb
221
217
  - app/serializers/forest_liana/intercom_attribute_serializer.rb
222
218
  - app/serializers/forest_liana/intercom_conversation_serializer.rb
223
219
  - app/serializers/forest_liana/mixpanel_event_serializer.rb
224
- - app/serializers/forest_liana/segment_serializer.rb
220
+ - app/serializers/forest_liana/schema_serializer.rb
225
221
  - app/serializers/forest_liana/serializer_factory.rb
226
222
  - app/serializers/forest_liana/session_serializer.rb
227
223
  - app/serializers/forest_liana/stat_serializer.rb
@@ -245,12 +241,10 @@ files:
245
241
  - app/services/forest_liana/intercom_conversations_getter.rb
246
242
  - app/services/forest_liana/ip_whitelist.rb
247
243
  - app/services/forest_liana/ip_whitelist_checker.rb
248
- - app/services/forest_liana/leaderboard_stat_getter.rb
249
244
  - app/services/forest_liana/line_stat_getter.rb
250
245
  - app/services/forest_liana/live_query_checker.rb
251
246
  - app/services/forest_liana/login_handler.rb
252
247
  - app/services/forest_liana/mixpanel_last_events_getter.rb
253
- - app/services/forest_liana/objective_stat_getter.rb
254
248
  - app/services/forest_liana/operator_date_interval_parser.rb
255
249
  - app/services/forest_liana/operator_value_parser.rb
256
250
  - app/services/forest_liana/permissions_checker.rb
@@ -289,60 +283,13 @@ files:
289
283
  - lib/forest_liana/bootstraper.rb
290
284
  - lib/forest_liana/collection.rb
291
285
  - lib/forest_liana/engine.rb
286
+ - lib/forest_liana/json_printer.rb
292
287
  - lib/forest_liana/mixpanel_event.rb
288
+ - lib/forest_liana/schema_file_updater.rb
293
289
  - lib/forest_liana/version.rb
294
290
  - lib/generators/forest_liana/install_generator.rb
295
291
  - lib/tasks/display_apimap.rake
296
292
  - lib/tasks/send_apimap.rake
297
- - spec/dummy/README.rdoc
298
- - spec/dummy/Rakefile
299
- - spec/dummy/app/assets/javascripts/application.js
300
- - spec/dummy/app/assets/stylesheets/application.css
301
- - spec/dummy/app/config/routes.rb
302
- - spec/dummy/app/controllers/application_controller.rb
303
- - spec/dummy/app/helpers/application_helper.rb
304
- - spec/dummy/app/models/island.rb
305
- - spec/dummy/app/models/tree.rb
306
- - spec/dummy/app/models/user.rb
307
- - spec/dummy/app/views/layouts/application.html.erb
308
- - spec/dummy/bin/bundle
309
- - spec/dummy/bin/rails
310
- - spec/dummy/bin/rake
311
- - spec/dummy/bin/setup
312
- - spec/dummy/config.ru
313
- - spec/dummy/config/application.rb
314
- - spec/dummy/config/boot.rb
315
- - spec/dummy/config/database.yml
316
- - spec/dummy/config/environment.rb
317
- - spec/dummy/config/environments/development.rb
318
- - spec/dummy/config/environments/production.rb
319
- - spec/dummy/config/environments/test.rb
320
- - spec/dummy/config/initializers/assets.rb
321
- - spec/dummy/config/initializers/backtrace_silencers.rb
322
- - spec/dummy/config/initializers/cookies_serializer.rb
323
- - spec/dummy/config/initializers/filter_parameter_logging.rb
324
- - spec/dummy/config/initializers/forest_liana.rb
325
- - spec/dummy/config/initializers/inflections.rb
326
- - spec/dummy/config/initializers/mime_types.rb
327
- - spec/dummy/config/initializers/session_store.rb
328
- - spec/dummy/config/initializers/wrap_parameters.rb
329
- - spec/dummy/config/routes.rb
330
- - spec/dummy/config/secrets.yml
331
- - spec/dummy/db/migrate/20190226172951_create_user.rb
332
- - spec/dummy/db/migrate/20190226173051_create_isle.rb
333
- - spec/dummy/db/migrate/20190226174951_create_tree.rb
334
- - spec/dummy/db/schema.rb
335
- - spec/dummy/db/test.sqlite3
336
- - spec/dummy/log/development.log
337
- - spec/dummy/log/test.log
338
- - spec/helpers/forest_liana/query_helper_spec.rb
339
- - spec/helpers/forest_liana/schema_helper_spec.rb
340
- - spec/rails_helper.rb
341
- - spec/requests/resources_spec.rb
342
- - spec/services/forest_liana/apimap_sorter_spec.rb
343
- - spec/services/forest_liana/ip_whitelist_checker_spec.rb
344
- - spec/services/forest_liana/schema_adapter_spec.rb
345
- - spec/spec_helper.rb
346
293
  - test/dummy/README.rdoc
347
294
  - test/dummy/Rakefile
348
295
  - test/dummy/app/assets/javascripts/application.js
@@ -427,6 +374,7 @@ files:
427
374
  - test/fixtures/string_field.yml
428
375
  - test/fixtures/tree.yml
429
376
  - test/forest_liana_test.rb
377
+ - test/integration/navigation_test.rb
430
378
  - test/routing/route_test.rb
431
379
  - test/services/forest_liana/has_many_getter_test.rb
432
380
  - test/services/forest_liana/pie_stat_getter_test.rb
@@ -435,9 +383,9 @@ files:
435
383
  - test/services/forest_liana/schema_adapter_test.rb
436
384
  - test/services/forest_liana/value_stat_getter_test.rb
437
385
  - test/test_helper.rb
438
- homepage: https://github.com/ForestAdmin/forest-rails
386
+ homepage:
439
387
  licenses:
440
- - GPL-3.0
388
+ - GPL v3
441
389
  metadata: {}
442
390
  post_install_message:
443
391
  rdoc_options: []
@@ -450,9 +398,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
450
398
  version: '0'
451
399
  required_rubygems_version: !ruby/object:Gem::Requirement
452
400
  requirements:
453
- - - ">="
401
+ - - ">"
454
402
  - !ruby/object:Gem::Version
455
- version: '0'
403
+ version: 1.3.1
456
404
  requirements: []
457
405
  rubyforge_project:
458
406
  rubygems_version: 2.6.14
@@ -534,6 +482,7 @@ test_files:
534
482
  - test/dummy/db/migrate/20150616150629_create_polymorphic_field.rb
535
483
  - test/dummy/log/test.log
536
484
  - test/dummy/README.rdoc
485
+ - test/integration/navigation_test.rb
537
486
  - test/forest_liana_test.rb
538
487
  - test/fixtures/has_many_through_field.yml
539
488
  - test/fixtures/string_field.yml
@@ -552,52 +501,3 @@ test_files:
552
501
  - test/services/forest_liana/has_many_getter_test.rb
553
502
  - test/services/forest_liana/pie_stat_getter_test.rb
554
503
  - test/services/forest_liana/resources_getter_test.rb
555
- - spec/spec_helper.rb
556
- - spec/dummy/app/config/routes.rb
557
- - spec/dummy/app/models/island.rb
558
- - spec/dummy/app/models/user.rb
559
- - spec/dummy/app/models/tree.rb
560
- - spec/dummy/app/controllers/application_controller.rb
561
- - spec/dummy/app/views/layouts/application.html.erb
562
- - spec/dummy/app/assets/javascripts/application.js
563
- - spec/dummy/app/assets/stylesheets/application.css
564
- - spec/dummy/app/helpers/application_helper.rb
565
- - spec/dummy/bin/rake
566
- - spec/dummy/bin/setup
567
- - spec/dummy/bin/bundle
568
- - spec/dummy/bin/rails
569
- - spec/dummy/config/secrets.yml
570
- - spec/dummy/config/routes.rb
571
- - spec/dummy/config/environments/production.rb
572
- - spec/dummy/config/environments/development.rb
573
- - spec/dummy/config/environments/test.rb
574
- - spec/dummy/config/environment.rb
575
- - spec/dummy/config/application.rb
576
- - spec/dummy/config/database.yml
577
- - spec/dummy/config/boot.rb
578
- - spec/dummy/config/initializers/backtrace_silencers.rb
579
- - spec/dummy/config/initializers/mime_types.rb
580
- - spec/dummy/config/initializers/filter_parameter_logging.rb
581
- - spec/dummy/config/initializers/session_store.rb
582
- - spec/dummy/config/initializers/wrap_parameters.rb
583
- - spec/dummy/config/initializers/assets.rb
584
- - spec/dummy/config/initializers/cookies_serializer.rb
585
- - spec/dummy/config/initializers/forest_liana.rb
586
- - spec/dummy/config/initializers/inflections.rb
587
- - spec/dummy/config.ru
588
- - spec/dummy/Rakefile
589
- - spec/dummy/db/schema.rb
590
- - spec/dummy/db/test.sqlite3
591
- - spec/dummy/db/migrate/20190226173051_create_isle.rb
592
- - spec/dummy/db/migrate/20190226174951_create_tree.rb
593
- - spec/dummy/db/migrate/20190226172951_create_user.rb
594
- - spec/dummy/log/test.log
595
- - spec/dummy/log/development.log
596
- - spec/dummy/README.rdoc
597
- - spec/requests/resources_spec.rb
598
- - spec/rails_helper.rb
599
- - spec/helpers/forest_liana/query_helper_spec.rb
600
- - spec/helpers/forest_liana/schema_helper_spec.rb
601
- - spec/services/forest_liana/schema_adapter_spec.rb
602
- - spec/services/forest_liana/apimap_sorter_spec.rb
603
- - spec/services/forest_liana/ip_whitelist_checker_spec.rb
@@ -1,30 +0,0 @@
1
- module ForestLiana
2
- module QueryHelper
3
- def self.get_one_associations(resource)
4
- SchemaUtils.one_associations(resource)
5
- .select { |association| SchemaUtils.model_included?(association.klass) }
6
- end
7
-
8
- def self.get_one_association_names_symbol(resource)
9
- self.get_one_associations(resource).map(&:name)
10
- end
11
-
12
- def self.get_one_association_names_string(resource)
13
- self.get_one_associations(resource).map { |association| association.name.to_s }
14
- end
15
-
16
- def self.get_tables_associated_to_relations_name(resource)
17
- tables_associated_to_relations_name = {}
18
- associations_has_one = self.get_one_associations(resource)
19
-
20
- associations_has_one.each do |association|
21
- if tables_associated_to_relations_name[association.table_name].nil?
22
- tables_associated_to_relations_name[association.table_name] = []
23
- end
24
- tables_associated_to_relations_name[association.table_name] << association.name
25
- end
26
-
27
- tables_associated_to_relations_name
28
- end
29
- end
30
- end
@@ -1,8 +0,0 @@
1
- module ForestLiana
2
- module SchemaHelper
3
- def self.find_collection_from_model(active_record_class)
4
- collection_name = ForestLiana.name_for(active_record_class)
5
- ForestLiana.apimap.find { |collection| collection.name.to_s == collection_name }
6
- end
7
- end
8
- end
@@ -1,21 +0,0 @@
1
- require 'jsonapi-serializers'
2
-
3
- class ForestLiana::ActionSerializer
4
- include JSONAPI::Serializer
5
-
6
- attribute :name
7
- attribute :http_method
8
- attribute :endpoint
9
- attribute :fields
10
- attribute :redirect
11
- attribute :type
12
- attribute :download
13
-
14
- def relationship_related_link(attribute_name)
15
- nil
16
- end
17
-
18
- def relationship_self_link(attribute_name)
19
- nil
20
- end
21
- end