openstax_api 9.3.1 → 9.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -2
- data/lib/openstax/api/engine.rb +0 -2
- data/lib/openstax/api/roar.rb +9 -4
- data/lib/openstax/api/version.rb +1 -1
- metadata +28 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 38214901e96102b30f2e965a8d76be40a3161a6eecac68ed55f7972aec08e24c
|
4
|
+
data.tar.gz: a07178d8f473c0d5c42ba2d0db035ad0875c33848b37c08bb796c99743d29c27
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d11ece505b9641257fb63868e7dc96193cce5b305cbcf68f1c059ae702d56eed7c6c0c7202e8eae9bb7bfe2d8ad6ecc72a6bb1cd70acacf970c6ecc7686bb0e0
|
7
|
+
data.tar.gz: a9036f52e817f6e1a857ed68ead9096d6ef41d81cbc202a2089bc3b6ae8ddb227f7553bee85a0cfaacc36860bbe1d9fd88ba7a99d4ddbe42f57b6364948754f5
|
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# openstax_api
|
2
2
|
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/openstax_api.svg)](http://badge.fury.io/rb/openstax_api)
|
4
|
-
[![
|
4
|
+
[![Tests](https://github.com/openstax/openstax_api/workflows/Tests/badge.svg)](https://github.com/openstax/openstax_api/actions?query=workflow:Tests)
|
5
5
|
[![Code Climate](https://codeclimate.com/github/openstax/openstax_api/badges/gpa.svg)](https://codeclimate.com/github/openstax/openstax_api)
|
6
6
|
|
7
7
|
API utilities for OpenStax products and tools.
|
@@ -79,4 +79,3 @@ From the gem's main folder, run `bundle`, `rake db:migrate` and then `rake` to r
|
|
79
79
|
5. Commit your changes (`git commit -am 'Add some feature'`)
|
80
80
|
6. Push to the branch (`git push origin my-new-feature`)
|
81
81
|
7. Create new pull request
|
82
|
-
|
data/lib/openstax/api/engine.rb
CHANGED
@@ -13,8 +13,6 @@ module OpenStax
|
|
13
13
|
class Engine < ::Rails::Engine
|
14
14
|
isolate_namespace OpenStax::Api
|
15
15
|
|
16
|
-
config.autoload_paths += Dir[config.root.join('app', 'representers', '{**}')]
|
17
|
-
|
18
16
|
config.generators do |g|
|
19
17
|
g.test_framework :rspec, fixture: false
|
20
18
|
g.fixture_replacement :factory_bot, dir: 'spec/factories'
|
data/lib/openstax/api/roar.rb
CHANGED
@@ -37,6 +37,8 @@ module OpenStax
|
|
37
37
|
OSU::AccessPolicy.require_action_allowed!(:read, user, item)
|
38
38
|
end
|
39
39
|
|
40
|
+
yield outputs if block_given?
|
41
|
+
|
40
42
|
respond_with outputs, { status: :ok, location: nil }.merge(represent_with_options)
|
41
43
|
end
|
42
44
|
|
@@ -150,8 +152,11 @@ module OpenStax
|
|
150
152
|
hash = { status: Rack::Utils.status_code(status) }
|
151
153
|
|
152
154
|
case errors
|
153
|
-
when ActiveModel::Errors
|
154
|
-
hash[:errors] = errors.map do |
|
155
|
+
when ActiveModel::Errors
|
156
|
+
hash[:errors] = errors.map do |error|
|
157
|
+
attribute = error.attribute
|
158
|
+
message = error.message
|
159
|
+
|
155
160
|
{
|
156
161
|
code: "#{attribute.to_s}_#{message.to_s.gsub(/[\s-]/, '_').gsub(/[^\w]/, '')}",
|
157
162
|
message: errors.full_message(attribute, message)
|
@@ -163,8 +168,8 @@ module OpenStax
|
|
163
168
|
end
|
164
169
|
else
|
165
170
|
hash[:errors] = [errors].flatten.map do |error|
|
166
|
-
error.is_a?(Hash) ? error :
|
167
|
-
|
171
|
+
error.is_a?(Hash) ? error :
|
172
|
+
{ code: error.to_s.underscore, message: error.to_s.humanize }
|
168
173
|
end
|
169
174
|
end
|
170
175
|
|
data/lib/openstax/api/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: openstax_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 9.
|
4
|
+
version: 9.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dante Soares
|
@@ -9,22 +9,28 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2022-09-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- - "
|
18
|
+
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
20
|
version: '5.2'
|
21
|
+
- - "<"
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: '7'
|
21
24
|
type: :runtime
|
22
25
|
prerelease: false
|
23
26
|
version_requirements: !ruby/object:Gem::Requirement
|
24
27
|
requirements:
|
25
|
-
- - "
|
28
|
+
- - ">="
|
26
29
|
- !ruby/object:Gem::Version
|
27
30
|
version: '5.2'
|
31
|
+
- - "<"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '7'
|
28
34
|
- !ruby/object:Gem::Dependency
|
29
35
|
name: addressable
|
30
36
|
requirement: !ruby/object:Gem::Requirement
|
@@ -73,14 +79,14 @@ dependencies:
|
|
73
79
|
requirements:
|
74
80
|
- - ">="
|
75
81
|
- !ruby/object:Gem::Version
|
76
|
-
version: '
|
82
|
+
version: '1'
|
77
83
|
type: :runtime
|
78
84
|
prerelease: false
|
79
85
|
version_requirements: !ruby/object:Gem::Requirement
|
80
86
|
requirements:
|
81
87
|
- - ">="
|
82
88
|
- !ruby/object:Gem::Version
|
83
|
-
version: '
|
89
|
+
version: '1'
|
84
90
|
- !ruby/object:Gem::Dependency
|
85
91
|
name: uber
|
86
92
|
requirement: !ruby/object:Gem::Requirement
|
@@ -143,14 +149,14 @@ dependencies:
|
|
143
149
|
requirements:
|
144
150
|
- - ">="
|
145
151
|
- !ruby/object:Gem::Version
|
146
|
-
version: '
|
152
|
+
version: '11'
|
147
153
|
type: :runtime
|
148
154
|
prerelease: false
|
149
155
|
version_requirements: !ruby/object:Gem::Requirement
|
150
156
|
requirements:
|
151
157
|
- - ">="
|
152
158
|
- !ruby/object:Gem::Version
|
153
|
-
version: '
|
159
|
+
version: '11'
|
154
160
|
- !ruby/object:Gem::Dependency
|
155
161
|
name: responders
|
156
162
|
requirement: !ruby/object:Gem::Requirement
|
@@ -179,6 +185,20 @@ dependencies:
|
|
179
185
|
- - ">="
|
180
186
|
- !ruby/object:Gem::Version
|
181
187
|
version: '0'
|
188
|
+
- !ruby/object:Gem::Dependency
|
189
|
+
name: listen
|
190
|
+
requirement: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - ">="
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: '0'
|
195
|
+
type: :development
|
196
|
+
prerelease: false
|
197
|
+
version_requirements: !ruby/object:Gem::Requirement
|
198
|
+
requirements:
|
199
|
+
- - ">="
|
200
|
+
- !ruby/object:Gem::Version
|
201
|
+
version: '0'
|
182
202
|
- !ruby/object:Gem::Dependency
|
183
203
|
name: sqlite3
|
184
204
|
requirement: !ruby/object:Gem::Requirement
|