pan_stuff 0.1.1 → 0.1.2

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: 5857ce870eff8f7737fdadc9e3571bc715822770b34435d2df1c936d55b5aaf7
4
- data.tar.gz: 5f7c155cd8e54aec8d91a23371bb09bb2a9d34c2c7a8c089b89d34f360a9e989
3
+ metadata.gz: 3a8ee46049c40e0fa2a7c098efaa968a978c9c4879a077bfa0ca7deec10d765c
4
+ data.tar.gz: 9aa8447920db74cd1c5f641e88b35560dd3fc009ea0c7383e36c4b2b8f2077a4
5
5
  SHA512:
6
- metadata.gz: 22b6e3d9155b85c59d3f3415022d22fdc5102f01454be40649dbaf3ccb6e349e2ede3c1e83b073796f69cdf13eec0bbebb154acdec6a20ef481b562d94cdb183
7
- data.tar.gz: 4adac5807208d6f6fe05296111625bc7c9221ba8614fc12e1c9936a612fdc653218181692072a22c08213244cc5e44adeb2477758cbb722b6a018b38a2bbdcc6
6
+ metadata.gz: cd34a1e1b946f158fd0db96fcee7669b5de4b5630b3f18798e5567d5984ffa5e1f55125fb26ebb1a10ce7d3f60429b248243b236909e1f15215daaeb10f9fee5
7
+ data.tar.gz: '0761028f3f5e5863e44af8364fe41e760034f9880c48104f8edb4a244a6986a910479a17a4c72fbca28098c4b2628516a60b10bf85c67615f7487eab45e9f5a5'
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
- require "bundler/setup"
1
+ # frozen_string_literal: true
2
2
 
3
- require "bundler/gem_tasks"
3
+ require 'bundler/setup'
4
+
5
+ require 'bundler/gem_tasks'
@@ -20,7 +20,7 @@ module PanStuff
20
20
  }
21
21
  [
22
22
  limit(limit).offset(offset),
23
- metadata,
23
+ metadata
24
24
  ]
25
25
  end
26
26
  end
@@ -1,37 +1,38 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module PanStuff
2
4
  class Railtie < ::Rails::Railtie
3
-
4
5
  initializer 'pan_stuff.setup_renderers' do
5
6
  ActionController::Renderers.add :resource do |resource, options|
6
7
  options = options.slice(:serializer, :meta, :message, :context, :message, :location)
7
-
8
- result = options[:serializer].new(resource, meta: options[:meta], message: options[:message]).as_json
9
-
8
+
9
+ result = options[:serializer].new(resource, meta: options[:meta], message: options[:message],
10
+ context: options[:context]).as_json
11
+
10
12
  self.content_type = Mime[:json]
11
-
13
+
12
14
  result
13
15
  end
14
-
16
+
15
17
  ActionController::Renderers.add :resource_errors do |errors, _options|
16
18
  result = PanStuff::Serializer::ResourceErrorsSerializer.new(errors).as_json
17
-
19
+
18
20
  self.content_type = Mime[:json]
19
-
21
+
20
22
  result
21
23
  end
22
-
24
+
23
25
  ActionController::Renderers.add :exception do |exception, options|
24
26
  options = options.slice(:status, :error)
25
-
27
+
26
28
  result = PanStuff::Serializer::ExceptionSerializer.new(exception: exception, root: false, **options).as_json
27
-
29
+
28
30
  self.content_type = Mime[:json]
29
-
31
+
30
32
  result
31
33
  end
32
34
 
33
- ActiveRecord::Base.send(:include, PanStuff::ActiveRecordPagination)
35
+ ActiveRecord::Base.include PanStuff::ActiveRecordPagination
34
36
  end
35
-
36
37
  end
37
38
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module PanStuff
2
- VERSION = "0.1.1"
4
+ VERSION = '0.1.2'
3
5
  end
data/lib/pan_stuff.rb CHANGED
@@ -1,4 +1,6 @@
1
- require "zeitwerk"
1
+ # frozen_string_literal: true
2
+
3
+ require 'zeitwerk'
2
4
 
3
5
  require 'active_model'
4
6
  require 'json'
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  # desc "Explaining what the task does"
2
4
  # task :pan_stuff do
3
5
  # # Task goes here
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pan_stuff
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Umberto Peserico
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2024-09-24 00:00:00.000000000 Z
12
+ date: 2025-01-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: money