alchemy-json_api 0.4.0 → 0.7.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ea47ab9f8a57a02051be3608bc9e9522278c4141df1faa904a58f523b288e0f5
4
- data.tar.gz: 26f82508a2ec37ec8545b3d2bb3d7430285b58a8187659f140a945057dbfc329
3
+ metadata.gz: 1fe4670c3c86dc4038be27367e22edf73b08771a8821897f7ff09155edeeac2b
4
+ data.tar.gz: 6df10ac401188dcc94e927569bc6b9fd1303b19b03a46738e296fd35cdd34619
5
5
  SHA512:
6
- metadata.gz: b48a6480ca4015eed8e7d4bc0a391e573bde8ed56a56c9024c8fbe2b54aa52f0de198c9975fc828ee5e50dd9ff21aa8b1f595fe0c914111c2ac073e95a722c7f
7
- data.tar.gz: e4c64ff707b456b459d3301f8d45118682f58b0e992ea6bda62d9db5b5edee3a66becc3feb0a6bdaf8136f76baeda73b20da367101f11615b6b67df724354b4e
6
+ metadata.gz: c537c5b7007113d5da441a755e1f138805782223015e50da29fe7c73476abdbd45b760dcb5088ad1ef2e866435d4439602d0ee71f90ce16c250376b948016b0e
7
+ data.tar.gz: '08e1e57a768cbcae7332257f97766175b9bf5b4d8520dd8fa0904d4b296a933154eeb3f0e7d7e0f4ce2dd06641153350d008671cebb3fd072f98d9185c7bb32c'
data/Rakefile CHANGED
@@ -26,3 +26,11 @@ task :test_setup do
26
26
  exit($?.exitstatus) unless $?.success?
27
27
  end
28
28
  end
29
+
30
+ require "github_changelog_generator/task"
31
+ require "alchemy/json_api/version"
32
+ GitHubChangelogGenerator::RakeTask.new(:changelog) do |config|
33
+ config.user = "AlchemyCMS"
34
+ config.project = "alchemy-json_api"
35
+ config.future_release = "v#{Alchemy::JsonApi::VERSION}"
36
+ end
@@ -7,6 +7,23 @@ module Alchemy
7
7
  include JSONAPI::Errors
8
8
  include JSONAPI::Filtering
9
9
  include JSONAPI::Pagination
10
+
11
+ private
12
+
13
+ def render_jsonapi_internal_server_error(exception)
14
+ log_error(exception)
15
+ super
16
+ end
17
+
18
+ def log_error(exception)
19
+ logger = Rails.logger
20
+ return unless logger
21
+
22
+ message = +"\n#{exception.class} (#{exception.message}):\n"
23
+ message << exception.annotated_source_code.to_s if exception.respond_to?(:annotated_source_code)
24
+ message << " " << exception.backtrace.join("\n ")
25
+ logger.fatal("#{message}\n\n")
26
+ end
10
27
  end
11
28
  end
12
29
  end
@@ -4,14 +4,16 @@ module Alchemy
4
4
  class ElementSerializer
5
5
  include FastJsonapi::ObjectSerializer
6
6
  attributes(
7
+ :name,
8
+ :fixed,
7
9
  :position,
8
10
  :created_at,
9
11
  :updated_at,
10
12
  )
11
- attribute :element_type, &:name
12
13
  belongs_to :parent_element, record_type: :element, serializer: self
13
14
 
14
- belongs_to :page
15
+ belongs_to :page, record_type: :page, serializer: ::Alchemy::JsonApi::PageSerializer
16
+
15
17
  has_many :essences, polymorphic: true do |element|
16
18
  element.contents.map(&:essence)
17
19
  end
@@ -10,7 +10,7 @@ module Alchemy
10
10
  essence&.node&.name
11
11
  end
12
12
 
13
- belongs_to :node
13
+ belongs_to :node, record_type: :node, serializer: ::Alchemy::JsonApi::NodeSerializer
14
14
 
15
15
  with_options if: proc { |essence| essence.node.present? } do
16
16
  attribute :name do |essence|
@@ -18,7 +18,7 @@ module Alchemy
18
18
  essence.page&.url_path
19
19
  end
20
20
 
21
- has_one :page, record_type: :page, serializer: PageSerializer
21
+ has_one :page, record_type: :page, serializer: ::Alchemy::JsonApi::PageSerializer
22
22
  end
23
23
  end
24
24
  end
@@ -10,13 +10,13 @@ module Alchemy
10
10
  :locale,
11
11
  )
12
12
 
13
- has_many :menu_items, record_type: :node, serializer: NodeSerializer, object_method_name: :nodes, id_method_name: :node_ids
13
+ has_many :menu_items, record_type: :node, serializer: ::Alchemy::JsonApi::NodeSerializer, object_method_name: :nodes, id_method_name: :node_ids
14
14
 
15
- has_many :menus, record_type: :node, serializer: NodeSerializer do |language|
15
+ has_many :menus, record_type: :node, serializer: ::Alchemy::JsonApi::NodeSerializer do |language|
16
16
  language.nodes.select { |n| n.parent.nil? }
17
17
  end
18
18
  has_many :pages
19
- has_one :root_page, record_type: :page, serializer: PageSerializer
19
+ has_one :root_page, record_type: :page, serializer: ::Alchemy::JsonApi::PageSerializer
20
20
 
21
21
  with_options if: ->(_, params) { params[:admin] == true } do
22
22
  attribute :created_at
@@ -15,11 +15,12 @@ module Alchemy
15
15
  :updated_at,
16
16
  )
17
17
 
18
- belongs_to :language
18
+ belongs_to :language, record_type: :language, serializer: ::Alchemy::JsonApi::LanguageSerializer
19
19
 
20
- has_many :elements
20
+ has_many :elements, record_type: :element, serializer: ::Alchemy::JsonApi::ElementSerializer
21
+ has_many :fixed_elements, record_type: :element, serializer: ::Alchemy::JsonApi::ElementSerializer
21
22
 
22
- has_many :all_elements, record_type: :element, serializer: ElementSerializer do |page|
23
+ has_many :all_elements, record_type: :element, serializer: ::Alchemy::JsonApi::ElementSerializer do |page|
23
24
  page.all_elements.select { |e| e.public? && !e.trashed? }
24
25
  end
25
26
 
@@ -4,7 +4,7 @@ module Alchemy
4
4
  module EssenceSerializer
5
5
  def self.included(klass)
6
6
  klass.include FastJsonapi::ObjectSerializer
7
- klass.has_one :element, record_type: :element, serializer: ElementSerializer do |essence|
7
+ klass.has_one :element, record_type: :element, serializer: ::Alchemy::JsonApi::ElementSerializer do |essence|
8
8
  essence.content.element
9
9
  end
10
10
  klass.attributes :ingredient
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  module Alchemy
3
3
  module JsonApi
4
- VERSION = "0.4.0"
4
+ VERSION = "0.7.2"
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alchemy-json_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martin Meyerhoff
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-28 00:00:00.000000000 Z
11
+ date: 2020-11-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: alchemy_cms
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: github_changelog_generator
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
69
83
  - !ruby/object:Gem::Dependency
70
84
  name: jsonapi-rspec
71
85
  requirement: !ruby/object:Gem::Requirement