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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 47b889836251bcd4224e3190630972dbb8bc97e5fc375f5e6cf9b0f05f0476e2
4
- data.tar.gz: 6fe3d8d7bd79c8d15dce658778436d526602436251a56e89a0fbd9c9f3e9416b
3
+ metadata.gz: 1ecb0295b8269be915ac5cdbff829ae83c7586724723119cb710b1abf4b3e4cb
4
+ data.tar.gz: 4c786b73b2309e47a74c5f388e7b5b77dc47f89be26145f9eb79db872861254c
5
5
  SHA512:
6
- metadata.gz: c230a81160d3ed0b4e92c55305dbc8066e76c84b365feef1d92ea716d06a8488731cc3e52463b19868031f3dbb848e87768a3370cf880d7cc35e678a93a85971
7
- data.tar.gz: fbd5d3f1df6c4a0665c24ef23b29a86eba8e9a828d49d389ca57a7fcd4eab1cae2077a929e8e97febcd638ac166df1a3099878aebfeec63ecc45b0a51773a4d5
6
+ metadata.gz: 5a4c9535550b5169650ce303a32206fab517ad9035f90d8876c0f170b9dd011f4a99ce2160e5f75428b0e5ba545bbc9b3e42ad9e4b78adec2d6025eef18822b0
7
+ data.tar.gz: bb0966222d62fc9d3e62acb549c19ed4974a83f73c90afbc935e741259c64100b3086879bf7eeeaf38653bd725e54152f57d23e9d28247685a66651f2abc1cf3
data/README.md CHANGED
@@ -1,6 +1,4 @@
1
- # JSONAPI::Resources [![Gem Version](https://badge.fury.io/rb/jsonapi-resources.svg)](https://badge.fury.io/rb/jsonapi-resources) [![Build Status](https://secure.travis-ci.org/cerebris/jsonapi-resources.svg?branch=master)](http://travis-ci.org/cerebris/jsonapi-resources) [![Code Climate](https://codeclimate.com/github/cerebris/jsonapi-resources/badges/gpa.svg)](https://codeclimate.com/github/cerebris/jsonapi-resources)
2
-
3
- [![Join the chat at https://gitter.im/cerebris/jsonapi-resources](https://badges.gitter.im/Join%20Chat.svg)](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 *should* be compatible with JSON:API compliant server implementations such as JR.
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
- ## Contributing
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
- 1. Submit an issue describing any new features you wish it add or the bug you intend to fix
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
- ## Did you find a bug?
55
+ ### For version 1 series
61
56
 
62
- * **Ensure the bug was not already reported** by searching on GitHub under [Issues](https://github.com/cerebris/jsonapi-resources/issues).
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
- * If you're unable to find an open issue addressing the problem, [open a new one](https://github.com/cerebris/jsonapi-resources/issues/new).
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
- * If possible, use the relevant bug report templates to create the issue.
69
- Simply copy the content of the appropriate template into a .rb file, make the necessary changes to demonstrate the issue,
70
- and **paste the content into the issue description or attach as a file**:
71
- * [**Rails 5** issues](https://github.com/cerebris/jsonapi-resources/blob/master/lib/bug_report_templates/rails_5_master.rb)
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 `send(:warn, ...)` to maintain compatibility with Rails 8+ where `warn`
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
- if ActiveSupport::Deprecation.respond_to?(:warn) && ActiveSupport::Deprecation.public_method_defined?(:warn)
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
@@ -1,5 +1,5 @@
1
1
  module JSONAPI
2
2
  module Resources
3
- VERSION = '0.3.0'
3
+ VERSION = '0.4.0'
4
4
  end
5
5
  end
@@ -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
- # :nocov:
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
- # :nocov:
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.3.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: 2026-01-26 00:00:00.000000000 Z
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: 5.10.2
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: '5.10'
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: 5.10.2
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: '5.1'
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: '5.1'
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: '5.1'
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: '5.1'
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.3'
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.2.33
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: []