hal_api-rails 1.2.0 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -1
- data/hal_api-rails.gemspec +3 -3
- data/lib/hal_api/controller/exceptions.rb +7 -5
- data/lib/hal_api/controller/filtering.rb +3 -1
- data/lib/hal_api/controller/sorting.rb +1 -1
- data/lib/hal_api/paged_collection.rb +1 -0
- data/lib/hal_api/rails/version.rb +1 -1
- data/lib/hal_api/representer/link_serialize.rb +2 -1
- metadata +13 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e860a4faedcb7482b0386c25f54c8772eb994462d701f2284102625779eb8495
|
4
|
+
data.tar.gz: c0d805143f39b55bd1c5eca1a806d6089705ff401a172237f33dc3e7405b21b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 33f3fbd03301ffe1b95bd2d386e81dcd424ef191e65be21817be4c96710af106c9ce1b86ecc8873e08b2d04b009d60fb886d2a73d8d199d56e2705797a32cf88
|
7
|
+
data.tar.gz: 2870c2e994dad97268a9024c8f12ff763b8f7aca902c7991f5651893ebdf6a6417486692a958374fa09edeba64e8766d7bfb36c1f112fb17eb95ab969d2d5666
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
3.3.2
|
data/hal_api-rails.gemspec
CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
|
|
11
11
|
spec.email = ['carhoden@gmail.com', 'andrew@beginsinwonder.com']
|
12
12
|
|
13
13
|
spec.summary = 'JSON HAL APIs on Rails in the style of PRX'
|
14
|
-
spec.description = 'JSON HAL APIs on Rails in the style of PRX
|
14
|
+
spec.description = 'JSON HAL APIs on Rails in the style of PRX. Uses ROAR'
|
15
15
|
spec.homepage = 'https://www.github.com/PRX/'
|
16
16
|
spec.license = 'MIT'
|
17
17
|
|
@@ -30,6 +30,6 @@ Gem::Specification.new do |spec|
|
|
30
30
|
spec.add_development_dependency 'minitest'
|
31
31
|
spec.add_development_dependency 'pry-byebug'
|
32
32
|
spec.add_development_dependency 'rack-test'
|
33
|
-
spec.add_development_dependency 'rails', '
|
34
|
-
spec.add_development_dependency 'rake', '>= 12
|
33
|
+
spec.add_development_dependency 'rails', '>= 5'
|
34
|
+
spec.add_development_dependency 'rake', '>= 12'
|
35
35
|
end
|
@@ -46,12 +46,14 @@ module HalApi::Controller::Exceptions
|
|
46
46
|
trace = wrapper.application_trace
|
47
47
|
trace = wrapper.framework_trace if trace.empty?
|
48
48
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
49
|
+
message = "\n#{exception.class} (#{exception.message}):\n"
|
50
|
+
if exception.respond_to?(:annoted_source_code)
|
51
|
+
ActiveSupport::Deprecation.silence do
|
52
|
+
message << exception.annoted_source_code.to_s
|
53
|
+
end
|
54
54
|
end
|
55
|
+
message << " " << trace.join("\n ")
|
56
|
+
logger.fatal("#{message}\n\n")
|
55
57
|
end
|
56
58
|
|
57
59
|
def notice_error(error)
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'ostruct'
|
2
|
+
|
1
3
|
module HalApi::Controller::Filtering
|
2
4
|
extend ActiveSupport::Concern
|
3
5
|
|
@@ -85,7 +87,7 @@ module HalApi::Controller::Filtering
|
|
85
87
|
|
86
88
|
# parse query param
|
87
89
|
(params[:filters] || '').split(',').each do |str|
|
88
|
-
name, value = str.split('=', 2)
|
90
|
+
name, value = (str || '').split('=', 2)
|
89
91
|
next unless filters_map.key?(name)
|
90
92
|
|
91
93
|
# convert/guess type of known params
|
@@ -43,7 +43,7 @@ module HalApi::Controller::Sorting
|
|
43
43
|
# parse sort param for name of the column and direction
|
44
44
|
# default is descending, because I say so, and we have a bias towards the new
|
45
45
|
(params[:sorts] || '').split(',').each do |str|
|
46
|
-
name, direction = str.split(':', 2).map { |s| s.to_s.strip }
|
46
|
+
name, direction = (str || '').split(':', 2).map { |s| s.to_s.strip }
|
47
47
|
name = name.underscore
|
48
48
|
direction = direction.blank? ? 'desc' : direction.downcase
|
49
49
|
unless allowed_sorts.include?(name)
|
@@ -15,7 +15,8 @@ module HalApi::Representer::LinkSerialize
|
|
15
15
|
if options.is_a?(Hash) && (options.delete(:writeable) || options[:reader])
|
16
16
|
name = options[:rel].to_s.split(':').last.split('/').last
|
17
17
|
pname = "set_#{name}_uri"
|
18
|
-
reader = options.delete(:reader) || ->(
|
18
|
+
reader = options.delete(:reader) || ->(obj) do
|
19
|
+
doc = obj[:doc]
|
19
20
|
try("#{name}_id=", id_from_url(doc[pname])) if doc[pname]
|
20
21
|
Representable::Pipeline::Stop
|
21
22
|
end
|
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hal_api-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Rhoden
|
8
8
|
- Andrew Kuklewicz
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2024-06-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activemodel
|
@@ -141,31 +141,31 @@ dependencies:
|
|
141
141
|
name: rails
|
142
142
|
requirement: !ruby/object:Gem::Requirement
|
143
143
|
requirements:
|
144
|
-
- - "
|
144
|
+
- - ">="
|
145
145
|
- !ruby/object:Gem::Version
|
146
|
-
version: 5
|
146
|
+
version: '5'
|
147
147
|
type: :development
|
148
148
|
prerelease: false
|
149
149
|
version_requirements: !ruby/object:Gem::Requirement
|
150
150
|
requirements:
|
151
|
-
- - "
|
151
|
+
- - ">="
|
152
152
|
- !ruby/object:Gem::Version
|
153
|
-
version: 5
|
153
|
+
version: '5'
|
154
154
|
- !ruby/object:Gem::Dependency
|
155
155
|
name: rake
|
156
156
|
requirement: !ruby/object:Gem::Requirement
|
157
157
|
requirements:
|
158
158
|
- - ">="
|
159
159
|
- !ruby/object:Gem::Version
|
160
|
-
version: 12
|
160
|
+
version: '12'
|
161
161
|
type: :development
|
162
162
|
prerelease: false
|
163
163
|
version_requirements: !ruby/object:Gem::Requirement
|
164
164
|
requirements:
|
165
165
|
- - ">="
|
166
166
|
- !ruby/object:Gem::Version
|
167
|
-
version: 12
|
168
|
-
description: JSON HAL APIs on Rails in the style of PRX
|
167
|
+
version: '12'
|
168
|
+
description: JSON HAL APIs on Rails in the style of PRX. Uses ROAR
|
169
169
|
email:
|
170
170
|
- carhoden@gmail.com
|
171
171
|
- andrew@beginsinwonder.com
|
@@ -212,7 +212,7 @@ homepage: https://www.github.com/PRX/
|
|
212
212
|
licenses:
|
213
213
|
- MIT
|
214
214
|
metadata: {}
|
215
|
-
post_install_message:
|
215
|
+
post_install_message:
|
216
216
|
rdoc_options: []
|
217
217
|
require_paths:
|
218
218
|
- lib
|
@@ -227,8 +227,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
227
227
|
- !ruby/object:Gem::Version
|
228
228
|
version: '0'
|
229
229
|
requirements: []
|
230
|
-
rubygems_version: 3.
|
231
|
-
signing_key:
|
230
|
+
rubygems_version: 3.5.9
|
231
|
+
signing_key:
|
232
232
|
specification_version: 4
|
233
233
|
summary: JSON HAL APIs on Rails in the style of PRX
|
234
234
|
test_files: []
|