snfoil-rails 0.8.3 → 0.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8317d5da3fd8d19a7ddc0c090c3065578d39ace6a431da7d3920e7dde76c92b0
4
- data.tar.gz: ac1beda041a2d44d7e5066b3c9f39d9b8a1f28d1a8fe0f0c5cbdaf93047054d0
3
+ metadata.gz: 4abac143f7db3746ad50a7835536622ca08da91556555127272e2d0727777283
4
+ data.tar.gz: 47a3e2f6b65d9fdcb7c8a0cc57a52c923c391186a2d0a7ec22823ddf2bc98769
5
5
  SHA512:
6
- metadata.gz: 70da8fe5e43597103002d545e6e48362ea855ffc78bf3edd1c6e4c4fcf2de745b28bed82bd1526c8801a23395b2d9a85436c69daa01f0243669c7786f73e9a68
7
- data.tar.gz: 0c0e11fed83253c68c9c393e96b9328cc6f4081b4aa832d4963cf4cf0402f795624dc38481dfbc4f2887f8fbf6762b1f15afb09cb82140307e1c4ca28dbc5090
6
+ metadata.gz: a56430ee62d999e3700787f1796de5391695b6ea32b4726532e6c1479e04270a87bbdbe4d6be0cdce73d9c79c8ae8df378c4750b8c3aae0c3ed2caa8adc20892
7
+ data.tar.gz: 99a012a6a90c784dcecf959f93f2b4c19cf05cca1a32e7b966fc641ca9014948f8a9a0bad9cf697d9262c1ef758d8d6234c9f4e4327b39a62f0b4c7aa8105b43
@@ -27,7 +27,7 @@ module SnFoil
27
27
  end
28
28
 
29
29
  def setup_options(**options)
30
- inject_deserialized_params(super)
30
+ inject_deserialized_params(**super)
31
31
  end
32
32
 
33
33
  def setup_create(**options)
@@ -24,11 +24,11 @@ module SnFoil
24
24
  end
25
25
 
26
26
  def process_index(**options)
27
- current_context(**options).index(options)
27
+ current_context(**options).index(**options)
28
28
  end
29
29
 
30
30
  def render_index(results, **options)
31
- render paginate(results, **options), meta: meta(results, options)
31
+ render paginate(results, **options), meta: meta(results, **options)
32
32
  end
33
33
 
34
34
  def paginate(results, **options)
@@ -120,7 +120,7 @@ module SnFoil
120
120
  return attributes unless resource_data
121
121
 
122
122
  resource_data = data_id(resource_data, resource_data)
123
- attribute_data = lookup_relationship(resource_data)
123
+ attribute_data = lookup_relationship(**resource_data)
124
124
  relationship_data = { data: attribute_data || resource_data }
125
125
  attributes[opts.fetch(:key) { key }] = deserializer.new(relationship_data, **options, included: included).parse
126
126
  attributes
@@ -132,7 +132,7 @@ module SnFoil
132
132
 
133
133
  attributes[opts.fetch(:key) { key }] = array_data.map do |resource_data|
134
134
  resource_data = data_id(resource_data, resource_data)
135
- attribute_data = lookup_relationship(resource_data)
135
+ attribute_data = lookup_relationship(**resource_data)
136
136
  relationship_data = { data: attribute_data || resource_data }
137
137
  deserializer.new(relationship_data, **options, included: included).parse
138
138
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module SnFoil
4
4
  module Rails
5
- VERSION = '0.8.3'
5
+ VERSION = '0.9.0'
6
6
  end
7
7
  end
@@ -85,16 +85,14 @@ module SnFoil
85
85
  end
86
86
 
87
87
  def apply_order(filtered_scope, params)
88
- return apply_default_order(filtered_scope, params) if params[:order_by].blank? && params[:order].blank?
89
-
90
- filtered_scope.order(order_by(params) => order(params))
91
- end
92
-
93
- def apply_default_order(filtered_scope, params)
94
88
  return order_method(filtered_scope, params) if order_method?
95
89
  return order_block(filtered_scope, params) if order_block?
96
90
 
97
- filtered_scope.order(order_by => order)
91
+ if params[:order_by].blank? && params[:order].blank?
92
+ filtered_scope.order(order_by => order)
93
+ else
94
+ filtered_scope.order(order_by(params) => order(params))
95
+ end
98
96
  end
99
97
 
100
98
  def order_method(filtered_scope, params)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: snfoil-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.3
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthew Howes
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2021-09-14 00:00:00.000000000 Z
13
+ date: 2023-02-20 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport
@@ -88,14 +88,14 @@ dependencies:
88
88
  requirements:
89
89
  - - '='
90
90
  - !ruby/object:Gem::Version
91
- version: 5.2.6
91
+ version: 6.1.7.1
92
92
  type: :development
93
93
  prerelease: false
94
94
  version_requirements: !ruby/object:Gem::Requirement
95
95
  requirements:
96
96
  - - '='
97
97
  - !ruby/object:Gem::Version
98
- version: 5.2.6
98
+ version: 6.1.7.1
99
99
  - !ruby/object:Gem::Dependency
100
100
  name: rake
101
101
  requirement: !ruby/object:Gem::Requirement
@@ -257,7 +257,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
257
257
  - !ruby/object:Gem::Version
258
258
  version: '0'
259
259
  requirements: []
260
- rubygems_version: 3.1.6
260
+ rubygems_version: 3.4.7
261
261
  signing_key:
262
262
  specification_version: 4
263
263
  summary: Additional functionality gem for using SnFoil with Rails