sanger-jsonapi-resources 0.3.0 → 0.4.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 +4 -4
- data/README.md +44 -26
- data/lib/jsonapi/compatibility_helper.rb +2 -7
- data/lib/jsonapi/resources/version.rb +1 -1
- data/lib/jsonapi/routing_ext.rb +4 -31
- metadata +65 -20
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1ecb0295b8269be915ac5cdbff829ae83c7586724723119cb710b1abf4b3e4cb
|
|
4
|
+
data.tar.gz: 4c786b73b2309e47a74c5f388e7b5b77dc47f89be26145f9eb79db872861254c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 5a4c9535550b5169650ce303a32206fab517ad9035f90d8876c0f170b9dd011f4a99ce2160e5f75428b0e5ba545bbc9b3e42ad9e4b78adec2d6025eef18822b0
|
|
7
|
+
data.tar.gz: bb0966222d62fc9d3e62acb549c19ed4974a83f73c90afbc935e741259c64100b3086879bf7eeeaf38653bd725e54152f57d23e9d28247685a66651f2abc1cf3
|
data/README.md
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
# JSONAPI::Resources
|
|
2
|
-
|
|
3
|
-
[](https://gitter.im/cerebris/jsonapi-resources?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
|
1
|
+
# JSONAPI::Resources (Sanger fork)
|
|
4
2
|
|
|
5
3
|
`JSONAPI::Resources`, or "JR", provides a framework for developing an API server that complies with the
|
|
6
4
|
[JSON:API](http://jsonapi.org/) specification.
|
|
@@ -13,7 +11,7 @@ backed by ActiveRecord models or by custom objects.
|
|
|
13
11
|
|
|
14
12
|
## Documentation
|
|
15
13
|
|
|
16
|
-
Full documentation can be found at [http://jsonapi-resources.com](http://jsonapi-resources.com), including the [v0.10 alpha Guide](http://jsonapi-resources.com/v0.10/guide/) specific to this version.
|
|
14
|
+
Full documentation can be found at [http://jsonapi-resources.com](http://jsonapi-resources.com), including the [v0.10 alpha Guide](http://jsonapi-resources.com/v0.10/guide/) specific to this version.
|
|
17
15
|
|
|
18
16
|
## Demo App
|
|
19
17
|
|
|
@@ -22,54 +20,74 @@ We have a simple demo app, called [Peeps](https://github.com/cerebris/peeps), av
|
|
|
22
20
|
## Client Libraries
|
|
23
21
|
|
|
24
22
|
JSON:API maintains a (non-verified) listing of [client libraries](http://jsonapi.org/implementations/#client-libraries)
|
|
25
|
-
which
|
|
23
|
+
which _should_ be compatible with JSON:API compliant server implementations such as JR.
|
|
26
24
|
|
|
27
25
|
## Installation
|
|
28
26
|
|
|
29
27
|
Add JR to your application's `Gemfile`:
|
|
30
28
|
|
|
31
|
-
```
|
|
29
|
+
```
|
|
32
30
|
gem 'jsonapi-resources'
|
|
33
31
|
```
|
|
34
32
|
|
|
35
33
|
And then execute:
|
|
36
34
|
|
|
37
|
-
```bash
|
|
35
|
+
```bash
|
|
38
36
|
bundle
|
|
39
37
|
```
|
|
40
38
|
|
|
41
39
|
Or install it yourself as:
|
|
42
40
|
|
|
43
|
-
```bash
|
|
41
|
+
```bash
|
|
44
42
|
gem install jsonapi-resources
|
|
45
43
|
```
|
|
46
44
|
|
|
47
45
|
**For further usage see the [v0.10 alpha Guide](http://jsonapi-resources.com/v0.10/guide/)**
|
|
48
46
|
|
|
49
|
-
##
|
|
47
|
+
## Sanger-specific release process
|
|
48
|
+
|
|
49
|
+
There are two versions of the gem which we use for production. The version 1 series has unique customisations and is used by Sequencescape. The version 2 series is a more generic version which is used by Traction.
|
|
50
|
+
|
|
51
|
+
The aim is to support the 3 most recent Rails versions for each series to allow for seamless upgrades between releases.
|
|
50
52
|
|
|
51
|
-
|
|
52
|
-
1. Fork it ( http://github.com/cerebris/jsonapi-resources/fork )
|
|
53
|
-
1. Create your feature branch (`git checkout -b my-new-feature`)
|
|
54
|
-
1. Run the full test suite (`rake test`)
|
|
55
|
-
1. Fix any failing tests
|
|
56
|
-
1. Commit your changes (`git commit -am 'Add some feature'`)
|
|
57
|
-
1. Push to the branch (`git push origin my-new-feature`)
|
|
58
|
-
1. Create a new Pull Request
|
|
53
|
+
Check which versions we have published at https://rubygems.org/gems/sanger-jsonapi-resources
|
|
59
54
|
|
|
60
|
-
|
|
55
|
+
### For version 1 series
|
|
61
56
|
|
|
62
|
-
|
|
57
|
+
- Create a branch from **develop**, apply fixes.
|
|
58
|
+
- Change version number in `lib/jsonapi/resources/version.rb` . This file is read by the gemspec during publication.
|
|
59
|
+
- Test Sequencescape with the gem from the branch.
|
|
60
|
+
- Merge the branch into develop.
|
|
61
|
+
- Create a release from the develop branch with the new version number as the tag. Set Release label to _None_.
|
|
62
|
+
<!-- list separator -->
|
|
63
|
+
- Checkout the newly-created tag on develop.
|
|
64
|
+
- Execute `bundle install` to ensure the gemspec is up to date.
|
|
65
|
+
- Execute `gem build jsonapi-resources.gemspec` which builds sanger-jsonapi-resources-0.1.x.gem in this case.
|
|
66
|
+
- Execute `gem push sanger-jsonapi-resources-0.1.x.gem` which publishes the gem.
|
|
63
67
|
|
|
64
|
-
|
|
65
|
-
Be sure to include a **title and clear description**, as much relevant information as possible,
|
|
66
|
-
and a **code sample** or an **executable test case** demonstrating the expected behavior that is not occurring.
|
|
68
|
+
### For version 2 series
|
|
67
69
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
- Create a branch from **master**, apply fixes.
|
|
71
|
+
- Change version number in `lib/jsonapi/resources/version.rb` . This file is read by the gemspec during publication.
|
|
72
|
+
- Test Traction with the gem from the branch.
|
|
73
|
+
- Merge the branch into master.
|
|
74
|
+
- Create a release from the master branch with the new version number as the tag. Set Release label to _Latest_.
|
|
75
|
+
<!-- list separator -->
|
|
76
|
+
- Checkout the newly-created tag on master.
|
|
77
|
+
- Execute `bundle install` to ensure the gemspec is up to date.
|
|
78
|
+
- Execute `gem build jsonapi-resources.gemspec` which builds sanger-jsonapi-resources-0.2.x.gem in this case.
|
|
79
|
+
- Execute `gem push sanger-jsonapi-resources-0.2.x.gem` which publishes the gem.
|
|
80
|
+
|
|
81
|
+
### Publication
|
|
82
|
+
|
|
83
|
+
You will be notified by email for each. You will also receive one email for API key setup. The first push will ask email and password for the account, which are in KeePass (search for "gem").
|
|
84
|
+
|
|
85
|
+
> [!NOTE]
|
|
86
|
+
> The email and password for gem publication is a recent addition to the credentials database. Pull latest changes in the credentials repo.
|
|
87
|
+
|
|
88
|
+
## Contributing
|
|
72
89
|
|
|
90
|
+
See CONTRIBUTING.md for details.
|
|
73
91
|
|
|
74
92
|
## License
|
|
75
93
|
|
|
@@ -9,8 +9,7 @@
|
|
|
9
9
|
# JSONAPI::CompatibilityHelper.deprecation_warn("Your deprecation message")
|
|
10
10
|
#
|
|
11
11
|
# The method will use the public `warn` method if available, otherwise it will
|
|
12
|
-
# use
|
|
13
|
-
# is private.
|
|
12
|
+
# use Rails 8+ style deprecation warnings.
|
|
14
13
|
#
|
|
15
14
|
# Example:
|
|
16
15
|
# JSONAPI::CompatibilityHelper.deprecation_warn("This feature is deprecated.")
|
|
@@ -18,11 +17,7 @@
|
|
|
18
17
|
module JSONAPI
|
|
19
18
|
module CompatibilityHelper
|
|
20
19
|
def deprecation_warn(message)
|
|
21
|
-
|
|
22
|
-
ActiveSupport::Deprecation.warn(message)
|
|
23
|
-
else
|
|
24
|
-
ActiveSupport::Deprecation.send(:warn, message)
|
|
25
|
-
end
|
|
20
|
+
ActiveSupport::Deprecation.new(nil, 'JSONAPI').warn(message)
|
|
26
21
|
end
|
|
27
22
|
module_function :deprecation_warn
|
|
28
23
|
end
|
data/lib/jsonapi/routing_ext.rb
CHANGED
|
@@ -46,28 +46,14 @@ module ActionDispatch
|
|
|
46
46
|
options[:except] << :destroy unless options[:except].include?(:destroy) || options[:except].include?('destroy')
|
|
47
47
|
end
|
|
48
48
|
|
|
49
|
-
resource @resource_type, options do
|
|
50
|
-
|
|
51
|
-
if @scope.respond_to? :[]=
|
|
52
|
-
# Rails 4
|
|
53
|
-
@scope[:jsonapi_resource] = @resource_type
|
|
54
|
-
|
|
49
|
+
resource @resource_type, **options do
|
|
50
|
+
jsonapi_resource_scope(SingletonResource.new(@resource_type, api_only?, @scope[:shallow], **options), @resource_type) do
|
|
55
51
|
if block_given?
|
|
56
52
|
yield
|
|
57
53
|
else
|
|
58
54
|
jsonapi_relationships
|
|
59
55
|
end
|
|
60
|
-
else
|
|
61
|
-
# Rails 5
|
|
62
|
-
jsonapi_resource_scope(SingletonResource.new(@resource_type, api_only?, @scope[:shallow], **options), @resource_type) do
|
|
63
|
-
if block_given?
|
|
64
|
-
yield
|
|
65
|
-
else
|
|
66
|
-
jsonapi_relationships
|
|
67
|
-
end
|
|
68
|
-
end
|
|
69
56
|
end
|
|
70
|
-
# :nocov:
|
|
71
57
|
end
|
|
72
58
|
end
|
|
73
59
|
|
|
@@ -121,27 +107,14 @@ module ActionDispatch
|
|
|
121
107
|
options[:except] << :destroy unless options[:except].include?(:destroy) || options[:except].include?('destroy')
|
|
122
108
|
end
|
|
123
109
|
|
|
124
|
-
resources @resource_type, options do
|
|
125
|
-
|
|
126
|
-
if @scope.respond_to? :[]=
|
|
127
|
-
# Rails 4
|
|
128
|
-
@scope[:jsonapi_resource] = @resource_type
|
|
110
|
+
resources @resource_type, **options do
|
|
111
|
+
jsonapi_resource_scope(Resource.new(@resource_type, api_only?, @scope[:shallow], **options), @resource_type) do
|
|
129
112
|
if block_given?
|
|
130
113
|
yield
|
|
131
114
|
else
|
|
132
115
|
jsonapi_relationships
|
|
133
116
|
end
|
|
134
|
-
else
|
|
135
|
-
# Rails 5
|
|
136
|
-
jsonapi_resource_scope(Resource.new(@resource_type, api_only?, @scope[:shallow], **options), @resource_type) do
|
|
137
|
-
if block_given?
|
|
138
|
-
yield
|
|
139
|
-
else
|
|
140
|
-
jsonapi_relationships
|
|
141
|
-
end
|
|
142
|
-
end
|
|
143
117
|
end
|
|
144
|
-
# :nocov:
|
|
145
118
|
end
|
|
146
119
|
end
|
|
147
120
|
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: sanger-jsonapi-resources
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- PSD Team - Wellcome Trust Sanger Institute
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: bundler
|
|
@@ -42,22 +41,30 @@ dependencies:
|
|
|
42
41
|
name: minitest
|
|
43
42
|
requirement: !ruby/object:Gem::Requirement
|
|
44
43
|
requirements:
|
|
45
|
-
- - "
|
|
46
|
-
- !ruby/object:Gem::Version
|
|
47
|
-
version: '5.10'
|
|
48
|
-
- - "!="
|
|
44
|
+
- - ">="
|
|
49
45
|
- !ruby/object:Gem::Version
|
|
50
|
-
version:
|
|
46
|
+
version: '0'
|
|
51
47
|
type: :development
|
|
52
48
|
prerelease: false
|
|
53
49
|
version_requirements: !ruby/object:Gem::Requirement
|
|
54
50
|
requirements:
|
|
55
|
-
- - "
|
|
51
|
+
- - ">="
|
|
52
|
+
- !ruby/object:Gem::Version
|
|
53
|
+
version: '0'
|
|
54
|
+
- !ruby/object:Gem::Dependency
|
|
55
|
+
name: minitest-mock
|
|
56
|
+
requirement: !ruby/object:Gem::Requirement
|
|
57
|
+
requirements:
|
|
58
|
+
- - ">="
|
|
56
59
|
- !ruby/object:Gem::Version
|
|
57
|
-
version: '
|
|
58
|
-
|
|
60
|
+
version: '0'
|
|
61
|
+
type: :development
|
|
62
|
+
prerelease: false
|
|
63
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
64
|
+
requirements:
|
|
65
|
+
- - ">="
|
|
59
66
|
- !ruby/object:Gem::Version
|
|
60
|
-
version:
|
|
67
|
+
version: '0'
|
|
61
68
|
- !ruby/object:Gem::Dependency
|
|
62
69
|
name: minitest-spec-rails
|
|
63
70
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -72,6 +79,20 @@ dependencies:
|
|
|
72
79
|
- - ">="
|
|
73
80
|
- !ruby/object:Gem::Version
|
|
74
81
|
version: '0'
|
|
82
|
+
- !ruby/object:Gem::Dependency
|
|
83
|
+
name: minitest-reporters
|
|
84
|
+
requirement: !ruby/object:Gem::Requirement
|
|
85
|
+
requirements:
|
|
86
|
+
- - ">="
|
|
87
|
+
- !ruby/object:Gem::Version
|
|
88
|
+
version: '0'
|
|
89
|
+
type: :development
|
|
90
|
+
prerelease: false
|
|
91
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
92
|
+
requirements:
|
|
93
|
+
- - ">="
|
|
94
|
+
- !ruby/object:Gem::Version
|
|
95
|
+
version: '0'
|
|
75
96
|
- !ruby/object:Gem::Dependency
|
|
76
97
|
name: simplecov
|
|
77
98
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -134,28 +155,54 @@ dependencies:
|
|
|
134
155
|
requirements:
|
|
135
156
|
- - ">="
|
|
136
157
|
- !ruby/object:Gem::Version
|
|
137
|
-
version: '
|
|
158
|
+
version: '7.1'
|
|
159
|
+
- - "<"
|
|
160
|
+
- !ruby/object:Gem::Version
|
|
161
|
+
version: '9.0'
|
|
138
162
|
type: :runtime
|
|
139
163
|
prerelease: false
|
|
140
164
|
version_requirements: !ruby/object:Gem::Requirement
|
|
141
165
|
requirements:
|
|
142
166
|
- - ">="
|
|
143
167
|
- !ruby/object:Gem::Version
|
|
144
|
-
version: '
|
|
168
|
+
version: '7.1'
|
|
169
|
+
- - "<"
|
|
170
|
+
- !ruby/object:Gem::Version
|
|
171
|
+
version: '9.0'
|
|
145
172
|
- !ruby/object:Gem::Dependency
|
|
146
173
|
name: railties
|
|
147
174
|
requirement: !ruby/object:Gem::Requirement
|
|
148
175
|
requirements:
|
|
149
176
|
- - ">="
|
|
150
177
|
- !ruby/object:Gem::Version
|
|
151
|
-
version: '
|
|
178
|
+
version: '7.1'
|
|
179
|
+
- - "<"
|
|
180
|
+
- !ruby/object:Gem::Version
|
|
181
|
+
version: '9.0'
|
|
152
182
|
type: :runtime
|
|
153
183
|
prerelease: false
|
|
154
184
|
version_requirements: !ruby/object:Gem::Requirement
|
|
155
185
|
requirements:
|
|
156
186
|
- - ">="
|
|
157
187
|
- !ruby/object:Gem::Version
|
|
158
|
-
version: '
|
|
188
|
+
version: '7.1'
|
|
189
|
+
- - "<"
|
|
190
|
+
- !ruby/object:Gem::Version
|
|
191
|
+
version: '9.0'
|
|
192
|
+
- !ruby/object:Gem::Dependency
|
|
193
|
+
name: rack
|
|
194
|
+
requirement: !ruby/object:Gem::Requirement
|
|
195
|
+
requirements:
|
|
196
|
+
- - "~>"
|
|
197
|
+
- !ruby/object:Gem::Version
|
|
198
|
+
version: '2.0'
|
|
199
|
+
type: :runtime
|
|
200
|
+
prerelease: false
|
|
201
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
202
|
+
requirements:
|
|
203
|
+
- - "~>"
|
|
204
|
+
- !ruby/object:Gem::Version
|
|
205
|
+
version: '2.0'
|
|
159
206
|
- !ruby/object:Gem::Dependency
|
|
160
207
|
name: concurrent-ruby
|
|
161
208
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -232,7 +279,6 @@ homepage: https://github.com/sanger/jsonapi-resources
|
|
|
232
279
|
licenses:
|
|
233
280
|
- MIT
|
|
234
281
|
metadata: {}
|
|
235
|
-
post_install_message:
|
|
236
282
|
rdoc_options: []
|
|
237
283
|
require_paths:
|
|
238
284
|
- lib
|
|
@@ -240,15 +286,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
240
286
|
requirements:
|
|
241
287
|
- - ">="
|
|
242
288
|
- !ruby/object:Gem::Version
|
|
243
|
-
version: '2
|
|
289
|
+
version: '3.2'
|
|
244
290
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
245
291
|
requirements:
|
|
246
292
|
- - ">="
|
|
247
293
|
- !ruby/object:Gem::Version
|
|
248
294
|
version: '0'
|
|
249
295
|
requirements: []
|
|
250
|
-
rubygems_version: 3.
|
|
251
|
-
signing_key:
|
|
296
|
+
rubygems_version: 3.6.9
|
|
252
297
|
specification_version: 4
|
|
253
298
|
summary: Easily support JSON API in Rails.
|
|
254
299
|
test_files: []
|