responsable 1.0.0 → 1.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: 89f9a11c6cabcab46760327a3b00c0ea696c2218d19a001c0efa1100855f8311
4
- data.tar.gz: 845c953d19e8fba04cdb2fe1f13d80e7d93b1cdf7c58ca76908a6f4231f40ad6
3
+ metadata.gz: 52e320e39a904bc3e39051f56e9ca53cb819eb79fc3105f8f09b26330fd82ae1
4
+ data.tar.gz: 5669065bc46f866cc0459c4a7fd422fbdcfdb88ffec709b672ec3872301c0d70
5
5
  SHA512:
6
- metadata.gz: 4784e9232b0fc5ac2ad23539624510685a15cb18a83184576beb6f5fb42411d083a1413e1a4b85e8cc1d8f52933bf3b00073471d372a4980e3d366b361799d31
7
- data.tar.gz: 4538867170df252c6b063733f5ba17c011f4fb97ca8c683cedb424dbc8a02e5ac5018ddc5dc3d0fc2397a58f272a4d89c3ca3240f9adbebef9209ac0fb2e1fc4
6
+ metadata.gz: 1cb6adf94d115ebda7802e6293a231e3e8ebde61889405a2247112b8c2b154410e76ad470acaf4e4f387d5c9ff7ce34879c8120d6252ef4b5ba0d93db06dd708
7
+ data.tar.gz: 1b1222f41bc7e17423423b1a448b6de976d50b0684af16493cb4d36d6d4a6236f9f1d6c23397f991b7740ee10fcc538ccacc6db50d141f918627ea9eb312ddab
data/CHANGELOG.md ADDED
@@ -0,0 +1,37 @@
1
+ # [1.4.0](https://gitlab.com/researchable/general/gems/responsable/compare/v1.3.0...v1.4.0) (2023-12-6)
2
+
3
+
4
+ ### Features
5
+
6
+ * disable MFA requirement because otherwise it breaks the automated pipeline ([0c3bf8d](https://gitlab.com/researchable/general/gems/responsable/commit/0c3bf8dbb67cb23b9913063b5dc484d1dd46f74f))
7
+ * rubocop + version bump ([e179223](https://gitlab.com/researchable/general/gems/responsable/commit/e17922334afd7dc3a882a38118a5379899a03c36))
8
+
9
+ # [1.3.0](https://gitlab.com/researchable/general/gems/responsable/compare/v1.2.0...v1.3.0) (2023-12-6)
10
+
11
+
12
+ ### Features
13
+
14
+ * Bump version number again ([e9ca8fb](https://gitlab.com/researchable/general/gems/responsable/commit/e9ca8fb70fca220898fba071f6dd9288e7c4bec4))
15
+
16
+ # [1.2.0](https://gitlab.com/researchable/general/gems/responsable/compare/v1.1.0...v1.2.0) (2023-12-6)
17
+
18
+
19
+ ### Features
20
+
21
+ * version bump ([15f9cb6](https://gitlab.com/researchable/general/gems/responsable/commit/15f9cb6a5579cbfecdf200946209248d87a4cb6e))
22
+
23
+ # [1.1.0](https://gitlab.com/researchable/general/gems/responsable/compare/v1.0.0...v1.1.0) (2023-12-5)
24
+
25
+
26
+ ### Features
27
+
28
+ * add #not_implemented ([deda9b2](https://gitlab.com/researchable/general/gems/responsable/commit/deda9b22a196372d5da474ad817311ddb34f5ee6))
29
+ * add #render_page method ([a666152](https://gitlab.com/researchable/general/gems/responsable/commit/a66615252855d554558c56640ccc924068a3e3bb))
30
+
31
+ # 1.0.0 (2023-04-20)
32
+
33
+
34
+ ### Features
35
+
36
+ * first implementation ([3a3635c](https://gitlab.com/researchable/general/gems/responsable/commit/3a3635c3565d266ae00b324ec7fa97266fc01f93))
37
+ * make serializer configurable ([29600cf](https://gitlab.com/researchable/general/gems/responsable/commit/29600cfecb942c8c9d6ecd5393845b45e7ef6abf))
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Responsable
2
2
 
3
- Responsable is a gem to standardize response objects and messages accross all Researchable's services.
3
+ Responsable is a gem to standardize response objects and messages across all Researchable's services.
4
4
 
5
5
  ## Installation
6
6
 
@@ -27,7 +27,7 @@ class ApplicationController < ActionController::Base
27
27
  end
28
28
  ```
29
29
 
30
- Then, in your controller actions, you can use any of the available response methods in lib/responsable.rb
30
+ Then, in your controller actions, you can use any of the available response methods in `lib/responsable.rb`.
31
31
 
32
32
  ## Development
33
33
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Responsable
4
- VERSION = '1.0.0'
4
+ VERSION = '1.4.0'
5
5
  end
data/lib/responsable.rb CHANGED
@@ -136,4 +136,40 @@ module Responsable
136
136
  ]
137
137
  }, status: :no_content
138
138
  end
139
+
140
+ # Method to render not implemented in a consistent way
141
+ # @param detail the description of the functionality that is not supported
142
+ def not_implemented(detail)
143
+ render json: {
144
+ result: [
145
+ {
146
+ status: '501',
147
+ title: 'Not Implemented',
148
+ detail: detail,
149
+ code: '100'
150
+ }
151
+ ]
152
+ }, status: :not_implemented
153
+ end
154
+
155
+ # Method to render paginated resources in a consistent way
156
+ # @param paginated_query the query that has been paginated with Kaminari
157
+ # @param serialized_data the serialized resource (should not be a hash `{data: ...}` to prevent double nesting)
158
+ def render_page(paginated_query, serialized_data)
159
+ if paginated_query.respond_to? :current_page
160
+ render json: {
161
+ data: serialized_data,
162
+ page: {
163
+ current_page: paginated_query.current_page,
164
+ next_page: paginated_query.next_page,
165
+ prev_page: paginated_query.prev_page,
166
+ total_count: paginated_query.total_count,
167
+ total_pages: paginated_query.total_pages,
168
+ has_next: !paginated_query.last_page? && paginated_query.size.positive?
169
+ }
170
+ }
171
+ else
172
+ not_implemented('a pagination gem that implements #current_page is needed')
173
+ end
174
+ end
139
175
  end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module TestGem
4
+ SOME_CONST = '1.1.2'
5
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module TestGem
4
+ VERSION = '0.1.0.alpha.1'
5
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module TestGem
4
+ VERSION = '1.4.0'
5
+ end
data/responsable.gemspec CHANGED
@@ -34,7 +34,12 @@ Gem::Specification.new do |spec|
34
34
 
35
35
  # For more information and examples about making a new gem, check out our
36
36
  # guide at: https://bundler.io/guides/creating_gem.html
37
+
38
+ # We have to disable MFA for pushing gems because otherwise we can't automate
39
+ # this process as we have the OTP code in 1pw somewhere.
40
+ # rubocop:disable Gemspec/RequireMFA
37
41
  spec.metadata = {
38
- 'rubygems_mfa_required' => 'true'
42
+ 'rubygems_mfa_required' => 'false'
39
43
  }
44
+ # rubocop:enable Gemspec/RequireMFA
40
45
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: responsable
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Researchable
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-04-20 00:00:00.000000000 Z
11
+ date: 2023-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dry-configurable
@@ -34,6 +34,7 @@ files:
34
34
  - ".editorconfig"
35
35
  - ".rspec"
36
36
  - ".rubocop.yml"
37
+ - CHANGELOG.md
37
38
  - Gemfile
38
39
  - Gemfile.lock
39
40
  - LICENSE.txt
@@ -41,13 +42,16 @@ files:
41
42
  - Rakefile
42
43
  - lib/responsable.rb
43
44
  - lib/responsable/version.rb
45
+ - node_modules/semantic-release-rubygem/src/__tests__/fixtures/invalid-version-file/lib/test-gem/version.rb
46
+ - node_modules/semantic-release-rubygem/src/__tests__/fixtures/prerelease/lib/test-gem/version.rb
47
+ - node_modules/semantic-release-rubygem/src/__tests__/fixtures/valid/lib/test-gem/version.rb
44
48
  - responsable.gemspec
45
49
  - sig/responsable.rbs
46
- homepage: https://gitlab.com/researchable/general/gems/responsable/-/blob/v1.0.0/README.md
50
+ homepage: https://gitlab.com/researchable/general/gems/responsable/-/blob/v1.4.0/README.md
47
51
  licenses:
48
52
  - MIT
49
53
  metadata:
50
- rubygems_mfa_required: 'true'
54
+ rubygems_mfa_required: 'false'
51
55
  post_install_message:
52
56
  rdoc_options: []
53
57
  require_paths:
@@ -63,7 +67,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
63
67
  - !ruby/object:Gem::Version
64
68
  version: '0'
65
69
  requirements: []
66
- rubygems_version: 3.3.26
70
+ rubygems_version: 3.4.19
67
71
  signing_key:
68
72
  specification_version: 4
69
73
  summary: Researchable's gem to standardize http REST responses