alchemy-json_api 0.3.0 → 0.4.0

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: 3046cd47b8e5d362917e2c8b595bc25c338e4bdf94a71dabb21794c1aabf913a
4
- data.tar.gz: 0670ad88fa25050738ce80692e1004b8b0016b3c25df8596f76fe0b054ed4e51
3
+ metadata.gz: ea47ab9f8a57a02051be3608bc9e9522278c4141df1faa904a58f523b288e0f5
4
+ data.tar.gz: 26f82508a2ec37ec8545b3d2bb3d7430285b58a8187659f140a945057dbfc329
5
5
  SHA512:
6
- metadata.gz: 9d48b6c6692e7330db7daeaedc03c177a89ec55225f0f3c96145fd42f7eccf972cc757a47120279f3cf34dffdb3b92aba9b8974a420743a7c0f2f35454fd5f68
7
- data.tar.gz: 9071f12da6fe44f21971cb85d53890691f0702f73396ec2e5ef08e7d6439d601aaa6625815c1a6867f15c25cdd23f1c69af67d1111769368df2d2b902e602407
6
+ metadata.gz: b48a6480ca4015eed8e7d4bc0a391e573bde8ed56a56c9024c8fbe2b54aa52f0de198c9975fc828ee5e50dd9ff21aa8b1f595fe0c914111c2ac073e95a722c7f
7
+ data.tar.gz: e4c64ff707b456b459d3301f8d45118682f58b0e992ea6bda62d9db5b5edee3a66becc3feb0a6bdaf8136f76baeda73b20da367101f11615b6b67df724354b4e
@@ -1,25 +1,27 @@
1
1
  # frozen_string_literal: true
2
- module Alchemy::JsonApi
3
- class ElementSerializer
4
- include FastJsonapi::ObjectSerializer
5
- attributes(
6
- :position,
7
- :created_at,
8
- :updated_at,
9
- )
10
- attribute :element_type, &:name
11
- belongs_to :parent_element, record_type: :element, serializer: self
2
+ module Alchemy
3
+ module JsonApi
4
+ class ElementSerializer
5
+ include FastJsonapi::ObjectSerializer
6
+ attributes(
7
+ :position,
8
+ :created_at,
9
+ :updated_at,
10
+ )
11
+ attribute :element_type, &:name
12
+ belongs_to :parent_element, record_type: :element, serializer: self
12
13
 
13
- belongs_to :page
14
- has_many :essences, polymorphic: true do |element|
15
- element.contents.map(&:essence)
16
- end
14
+ belongs_to :page
15
+ has_many :essences, polymorphic: true do |element|
16
+ element.contents.map(&:essence)
17
+ end
17
18
 
18
- has_many :nested_elements, record_type: :element, serializer: self
19
+ has_many :nested_elements, record_type: :element, serializer: self
19
20
 
20
- with_options if: ->(_, params) { params[:admin] == true } do
21
- attribute :tag_list
22
- attribute :display_name, &:display_name_with_preview_text
21
+ with_options if: ->(_, params) { params[:admin] == true } do
22
+ attribute :tag_list
23
+ attribute :display_name, &:display_name_with_preview_text
24
+ end
23
25
  end
24
26
  end
25
27
  end
@@ -1,8 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
  require "alchemy/json_api/essence_serializer"
3
3
 
4
- module Alchemy::JsonApi
5
- class EssenceBooleanSerializer
6
- include EssenceSerializer
4
+ module Alchemy
5
+ module JsonApi
6
+ class EssenceBooleanSerializer
7
+ include EssenceSerializer
8
+ end
7
9
  end
8
10
  end
@@ -1,8 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
  require "alchemy/json_api/essence_serializer"
3
3
 
4
- module Alchemy::JsonApi
5
- class EssenceDateSerializer
6
- include EssenceSerializer
4
+ module Alchemy
5
+ module JsonApi
6
+ class EssenceDateSerializer
7
+ include EssenceSerializer
8
+ end
7
9
  end
8
10
  end
@@ -1,29 +1,31 @@
1
1
  # frozen_string_literal: true
2
2
  require "alchemy/json_api/essence_serializer"
3
3
 
4
- module Alchemy::JsonApi
5
- class EssenceFileSerializer
6
- include EssenceSerializer
4
+ module Alchemy
5
+ module JsonApi
6
+ class EssenceFileSerializer
7
+ include EssenceSerializer
7
8
 
8
- attribute :link_title, &:title
9
+ attribute :link_title, &:title
9
10
 
10
- attribute :ingredient, &:attachment_url
11
+ attribute :ingredient, &:attachment_url
11
12
 
12
- with_options if: proc { |essence| essence.attachment.present? } do
13
- attribute :attachment_name do |essence|
14
- essence.attachment.name
15
- end
13
+ with_options if: proc { |essence| essence.attachment.present? } do
14
+ attribute :attachment_name do |essence|
15
+ essence.attachment.name
16
+ end
16
17
 
17
- attribute :attachment_file_name do |essence|
18
- essence.attachment.file_name
19
- end
18
+ attribute :attachment_file_name do |essence|
19
+ essence.attachment.file_name
20
+ end
20
21
 
21
- attribute :attachment_mime_type do |essence|
22
- essence.attachment.file_mime_type
23
- end
22
+ attribute :attachment_mime_type do |essence|
23
+ essence.attachment.file_mime_type
24
+ end
24
25
 
25
- attribute :attachment_file_size do |essence|
26
- essence.attachment.file_size
26
+ attribute :attachment_file_size do |essence|
27
+ essence.attachment.file_size
28
+ end
27
29
  end
28
30
  end
29
31
  end
@@ -1,8 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
  require "alchemy/json_api/essence_serializer"
3
3
 
4
- module Alchemy::JsonApi
5
- class EssenceHtmlSerializer
6
- include EssenceSerializer
4
+ module Alchemy
5
+ module JsonApi
6
+ class EssenceHtmlSerializer
7
+ include EssenceSerializer
8
+ end
7
9
  end
8
10
  end
@@ -1,12 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
  require "alchemy/json_api/essence_serializer"
3
3
 
4
- module Alchemy::JsonApi
5
- class EssenceLinkSerializer
6
- include EssenceSerializer
7
- attributes(
8
- :link_title,
9
- :link_target,
10
- )
4
+ module Alchemy
5
+ module JsonApi
6
+ class EssenceLinkSerializer
7
+ include EssenceSerializer
8
+ attributes(
9
+ :link_title,
10
+ :link_target,
11
+ )
12
+ end
11
13
  end
12
14
  end
@@ -1,31 +1,33 @@
1
1
  # frozen_string_literal: true
2
2
  require "alchemy/json_api/essence_serializer"
3
3
 
4
- module Alchemy::JsonApi
5
- class EssenceNodeSerializer
6
- include EssenceSerializer
4
+ module Alchemy
5
+ module JsonApi
6
+ class EssenceNodeSerializer
7
+ include EssenceSerializer
7
8
 
8
- attribute :ingredient do |essence|
9
- essence&.node&.name
10
- end
9
+ attribute :ingredient do |essence|
10
+ essence&.node&.name
11
+ end
11
12
 
12
- belongs_to :node
13
+ belongs_to :node
13
14
 
14
- with_options if: proc { |essence| essence.node.present? } do
15
- attribute :name do |essence|
16
- essence.node.name
17
- end
15
+ with_options if: proc { |essence| essence.node.present? } do
16
+ attribute :name do |essence|
17
+ essence.node.name
18
+ end
18
19
 
19
- attribute :link_url do |essence|
20
- essence.node.url
21
- end
20
+ attribute :link_url do |essence|
21
+ essence.node.url
22
+ end
22
23
 
23
- attribute :link_title do |essence|
24
- essence.node.title
25
- end
24
+ attribute :link_title do |essence|
25
+ essence.node.title
26
+ end
26
27
 
27
- attribute :link_nofollow do |essence|
28
- essence.node.nofollow
28
+ attribute :link_nofollow do |essence|
29
+ essence.node.nofollow
30
+ end
29
31
  end
30
32
  end
31
33
  end
@@ -1,22 +1,24 @@
1
1
  # frozen_string_literal: true
2
2
  require "alchemy/json_api/essence_serializer"
3
3
 
4
- module Alchemy::JsonApi
5
- class EssencePageSerializer
6
- include EssenceSerializer
4
+ module Alchemy
5
+ module JsonApi
6
+ class EssencePageSerializer
7
+ include EssenceSerializer
7
8
 
8
- attribute :ingredient do |essence|
9
- essence.page&.url_path
10
- end
9
+ attribute :ingredient do |essence|
10
+ essence.page&.url_path
11
+ end
11
12
 
12
- attribute :page_name do |essence|
13
- essence.page&.name
14
- end
13
+ attribute :page_name do |essence|
14
+ essence.page&.name
15
+ end
15
16
 
16
- attribute :page_url do |essence|
17
- essence.page&.url_path
18
- end
17
+ attribute :page_url do |essence|
18
+ essence.page&.url_path
19
+ end
19
20
 
20
- has_one :page, record_type: :page, serializer: PageSerializer
21
+ has_one :page, record_type: :page, serializer: PageSerializer
22
+ end
21
23
  end
22
24
  end
@@ -1,39 +1,41 @@
1
1
  # frozen_string_literal: true
2
2
  require "alchemy/json_api/essence_serializer"
3
3
 
4
- module Alchemy::JsonApi
5
- class EssencePictureSerializer
6
- include EssenceSerializer
4
+ module Alchemy
5
+ module JsonApi
6
+ class EssencePictureSerializer
7
+ include EssenceSerializer
7
8
 
8
- attributes(
9
- :title,
10
- :caption,
11
- :link_title,
12
- :link_target,
13
- )
14
- attribute :ingredient, &:picture_url
15
- attribute :alt_text, &:alt_tag
16
- attribute :link_url, &:link
9
+ attributes(
10
+ :title,
11
+ :caption,
12
+ :link_title,
13
+ :link_target,
14
+ )
15
+ attribute :ingredient, &:picture_url
16
+ attribute :alt_text, &:alt_tag
17
+ attribute :link_url, &:link
17
18
 
18
- with_options if: proc { |essence| essence.picture.present? } do
19
- attribute :image_dimensions do |essence|
20
- essence.sizes_from_string(essence.render_size)
21
- end
19
+ with_options if: proc { |essence| essence.picture.present? } do
20
+ attribute :image_dimensions do |essence|
21
+ essence.sizes_from_string(essence.render_size)
22
+ end
22
23
 
23
- attribute :image_name do |essence|
24
- essence.picture.name
25
- end
24
+ attribute :image_name do |essence|
25
+ essence.picture.name
26
+ end
26
27
 
27
- attribute :image_file_name do |essence|
28
- essence.picture.image_file_name
29
- end
28
+ attribute :image_file_name do |essence|
29
+ essence.picture.image_file_name
30
+ end
30
31
 
31
- attribute :image_mime_type do |essence|
32
- "image/#{essence.picture.image_file_format}"
33
- end
32
+ attribute :image_mime_type do |essence|
33
+ "image/#{essence.picture.image_file_format}"
34
+ end
34
35
 
35
- attribute :image_file_size do |essence|
36
- essence.picture.image_file_size
36
+ attribute :image_file_size do |essence|
37
+ essence.picture.image_file_size
38
+ end
37
39
  end
38
40
  end
39
41
  end
@@ -1,12 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
  require "alchemy/json_api/essence_serializer"
3
3
 
4
- module Alchemy::JsonApi
5
- class EssenceRichtextSerializer
6
- include EssenceSerializer
7
- attributes(
8
- :body,
9
- :stripped_body,
10
- )
4
+ module Alchemy
5
+ module JsonApi
6
+ class EssenceRichtextSerializer
7
+ include EssenceSerializer
8
+ attributes(
9
+ :body,
10
+ :stripped_body,
11
+ )
12
+ end
11
13
  end
12
14
  end
@@ -1,8 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
  require "alchemy/json_api/essence_serializer"
3
3
 
4
- module Alchemy::JsonApi
5
- class EssenceSelectSerializer
6
- include EssenceSerializer
4
+ module Alchemy
5
+ module JsonApi
6
+ class EssenceSelectSerializer
7
+ include EssenceSerializer
8
+ end
7
9
  end
8
10
  end
@@ -1,14 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
  require "alchemy/json_api/essence_serializer"
3
3
 
4
- module Alchemy::JsonApi
5
- class EssenceTextSerializer
6
- include EssenceSerializer
7
- attributes(
8
- :body,
9
- :link_title,
10
- :link_target,
11
- )
12
- attribute :link_url, &:link
4
+ module Alchemy
5
+ module JsonApi
6
+ class EssenceTextSerializer
7
+ include EssenceSerializer
8
+ attributes(
9
+ :body,
10
+ :link_title,
11
+ :link_target,
12
+ )
13
+ attribute :link_url, &:link
14
+ end
13
15
  end
14
16
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
  module Alchemy
3
3
  module JsonApi
4
- VERSION = "0.3.0"
4
+ VERSION = "0.4.0"
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alchemy-json_api
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
  - Martin Meyerhoff