jsonapi-resources 0.10.2 → 0.10.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d101bf5764e1eb80096aeeed45eed01a532e183995908d9f66a2143cb78e24df
4
- data.tar.gz: 38911d1428d934a71d06bfac0ad0661a2faa25af2b5de9ac695ec5b620b4c011
3
+ metadata.gz: 12f47ee89d33c3dc5b366b6538fe8af7719516ae5dfedab08f9d70ae28f378c9
4
+ data.tar.gz: 67c77d1af31817ed6126f43481fd3cc122dc9387c2187c0d09fd29503a402e58
5
5
  SHA512:
6
- metadata.gz: 6ec8d28ba3b475796ba5947bec8f548c154acfbf73ae3af44c0c20516dd4b756a45d3cbd4797f0162bbdc288e0b055599ef5044f500babdcf19ced3509887021
7
- data.tar.gz: 4698f7ddd9b9893e310c00fde96d8fef84d0e79ad3261ed574b08c7b60d1e415f5565eb8620752d11136e16df63675c7923006ea6344805a1fd102634bd27e2d
6
+ metadata.gz: d7c39545ce4f74f8068c8841796806ba5c757bac2bd830fd0bacb1facd21810bfbcb5e40b2ec501cf9558e1069ff9e3dfaf43b7a942b17200dcdf028a0e98432
7
+ data.tar.gz: 3ef5723ed2f96673d14372a2c11f28224d381fabe9a8c8b3b9373f8d6868a930de49349cdccff9203dab6b417241043635b84a9470bf41c4fb96096991b61e98
@@ -395,7 +395,7 @@ module JSONAPI
395
395
  sort_criteria: sort_criteria,
396
396
  filters: filters)
397
397
 
398
- paginator = options[:paginator] if source_rids.count == 1
398
+ paginator = options[:paginator]
399
399
 
400
400
  records = apply_request_settings_to_records(records: records_for_source_to_related(options),
401
401
  resource_klass: resource_klass,
@@ -525,7 +525,7 @@ module JSONAPI
525
525
  relationships: linkage_relationships,
526
526
  filters: filters)
527
527
 
528
- paginator = options[:paginator] if source_rids.count == 1
528
+ paginator = options[:paginator]
529
529
 
530
530
  # Note: We will sort by the source table. Without using unions we can't sort on a polymorphic relationship
531
531
  # in any manner that makes sense
@@ -18,7 +18,7 @@ module JSONAPI
18
18
  :default_paginator,
19
19
  :default_page_size,
20
20
  :maximum_page_size,
21
- :default_processor_klass,
21
+ :default_processor_klass_name,
22
22
  :use_text_errors,
23
23
  :top_level_links_include_pagination,
24
24
  :top_level_meta_include_record_count,
@@ -110,7 +110,7 @@ module JSONAPI
110
110
 
111
111
  # The default Operation Processor to use if one is not defined specifically
112
112
  # for a Resource.
113
- self.default_processor_klass = JSONAPI::Processor
113
+ self.default_processor_klass_name = 'JSONAPI::Processor'
114
114
 
115
115
  # Allows transactions for creating and updating records
116
116
  # Set this to false if your backend does not support transactions (e.g. Mongodb)
@@ -225,9 +225,19 @@ module JSONAPI
225
225
  end
226
226
 
227
227
  def default_processor_klass=(default_processor_klass)
228
+ ActiveSupport::Deprecation.warn('`default_processor_klass` has been replaced by `default_processor_klass_name`.')
228
229
  @default_processor_klass = default_processor_klass
229
230
  end
230
231
 
232
+ def default_processor_klass
233
+ @default_processor_klass ||= default_processor_klass_name.safe_constantize
234
+ end
235
+
236
+ def default_processor_klass_name=(default_processor_klass_name)
237
+ @default_processor_klass = nil
238
+ @default_processor_klass_name = default_processor_klass_name
239
+ end
240
+
231
241
  def allow_include=(allow_include)
232
242
  ActiveSupport::Deprecation.warn('`allow_include` has been replaced by `default_allow_include_to_one` and `default_allow_include_to_many` options.')
233
243
  @default_allow_include_to_one = allow_include
@@ -392,7 +392,7 @@ module JSONAPI
392
392
  primary_resource_id_tree = PrimaryResourceIdTree.new
393
393
  primary_resource_id_tree.add_resource_fragments(fragments, include_related)
394
394
 
395
- load_included(resource_klass, primary_resource_id_tree, include_related, options.except(:filters, :sort_criteria))
395
+ load_included(resource_klass, primary_resource_id_tree, include_related, options)
396
396
 
397
397
  primary_resource_id_tree
398
398
  end
@@ -406,7 +406,7 @@ module JSONAPI
406
406
  primary_resource_id_tree = PrimaryResourceIdTree.new
407
407
  primary_resource_id_tree.add_resource_fragments(fragments, include_related)
408
408
 
409
- load_included(resource_klass, primary_resource_id_tree, include_related, options.except(:filters, :sort_criteria))
409
+ load_included(resource_klass, primary_resource_id_tree, include_related, options)
410
410
 
411
411
  primary_resource_id_tree
412
412
  end
@@ -422,7 +422,7 @@ module JSONAPI
422
422
  primary_resource_id_tree = PrimaryResourceIdTree.new
423
423
  primary_resource_id_tree.add_resource_fragments(fragments, include_related)
424
424
 
425
- load_included(resource_klass, primary_resource_id_tree, include_related, options.except(:filters, :sort_criteria))
425
+ load_included(resource_klass, primary_resource_id_tree, include_related, options)
426
426
 
427
427
  primary_resource_id_tree
428
428
  end
@@ -434,7 +434,7 @@ module JSONAPI
434
434
  relationship = resource_klass._relationship(key)
435
435
  relationship_name = relationship.name.to_sym
436
436
 
437
- find_related_resource_options = options.dup
437
+ find_related_resource_options = options.except(:filters, :sort_criteria, :paginator)
438
438
  find_related_resource_options[:sort_criteria] = relationship.resource_klass.default_sort
439
439
  find_related_resource_options[:cache] = resource_klass.caching?
440
440
 
@@ -1,5 +1,5 @@
1
1
  module JSONAPI
2
2
  module Resources
3
- VERSION = '0.10.2'
3
+ VERSION = '0.10.3'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jsonapi-resources
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.2
4
+ version: 0.10.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Gebhardt
@@ -9,22 +9,22 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-12-11 00:00:00.000000000 Z
12
+ date: 2021-01-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - "~>"
18
+ - - ">="
19
19
  - !ruby/object:Gem::Version
20
- version: 1.17.3
20
+ version: '1.17'
21
21
  type: :development
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - "~>"
25
+ - - ">="
26
26
  - !ruby/object:Gem::Version
27
- version: 1.17.3
27
+ version: '1.17'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: rake
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -247,7 +247,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
247
247
  - !ruby/object:Gem::Version
248
248
  version: '0'
249
249
  requirements: []
250
- rubygems_version: 3.0.3
250
+ rubygems_version: 3.2.3
251
251
  signing_key:
252
252
  specification_version: 4
253
253
  summary: Easily support JSON API in Rails.