Class: SimpleJsonapi::Serializer
- Inherits:
-
Object
- Object
- SimpleJsonapi::Serializer
- Includes:
- SerializerMethods
- Defined in:
- lib/simple_jsonapi/serializer.rb
Overview
Subclass Serializer to create serializers for specific types of resources.
Class Method Summary collapse
- .attribute(name, **options, &block) ⇒ void
- #has_many(name, description: nil, **options, &block) ⇒ void
- #has_one(name, description: nil, **options, &block) ⇒ void
- .id(*args, &block) ⇒ void
- .link(name, *args, **options, &block) ⇒ void
- .meta(name, *args, **options, &block) ⇒ void
- .type(*args, &block) ⇒ void
Instance Method Summary collapse
- #attribute_definitions ⇒ Hash{Symbol => Attribute}
- #id_definition ⇒ Proc
- #link_definitions ⇒ Hash{Symbol => String,Object}
- #meta_definitions ⇒ Hash{Symbol => String,Object}
- #relationship_definitions ⇒ Hash{Symbol => Relationship}
- #type_definition ⇒ Proc
Methods included from SerializerMethods
Class Method Details
.attribute(name, options = {}) ⇒ void .attribute(name, options = {}, &block) ⇒ void #id(&block) ⇒ void #id(value) ⇒ void
23 24 25 |
# File 'lib/simple_jsonapi/serializer.rb', line 23 def attribute(name, **, &block) definition.attribute(name, **, &block) end |
#has_many(name, description: nil, **options, &block) ⇒ void
This method returns an undefined value.
41 42 43 |
# File 'lib/simple_jsonapi/serializer.rb', line 41 def has_many(name, **, &block) definition.has_many(name, **, &block) end |
#has_one(name, description: nil, **options, &block) ⇒ void
This method returns an undefined value.
32 33 34 |
# File 'lib/simple_jsonapi/serializer.rb', line 32 def has_one(name, **, &block) definition.has_one(name, **, &block) end |
#id(&block) ⇒ void #id(value) ⇒ void
This method returns an undefined value.
8 9 10 |
# File 'lib/simple_jsonapi/serializer.rb', line 8 def id(*args, &block) definition.id(*args, &block) end |
#link(name, options = {}, &block) ⇒ void #link(name, value, options = {}) ⇒ void
This method returns an undefined value.
47 48 49 |
# File 'lib/simple_jsonapi/serializer.rb', line 47 def link(name, *args, **, &block) definition.link(name, *args, **, &block) end |
#meta(name, options = {}, &block) ⇒ void #meta(name, value, options = {}) ⇒ void
This method returns an undefined value.
53 54 55 |
# File 'lib/simple_jsonapi/serializer.rb', line 53 def (name, *args, **, &block) definition.(name, *args, **, &block) end |
#type(&block) ⇒ void #type(value) ⇒ void
This method returns an undefined value.
14 15 16 |
# File 'lib/simple_jsonapi/serializer.rb', line 14 def type(*args, &block) definition.type(*args, &block) end |
Instance Method Details
#attribute_definitions ⇒ Hash{Symbol => Attribute}
71 72 73 |
# File 'lib/simple_jsonapi/serializer.rb', line 71 def attribute_definitions definition.attribute_definitions end |
#id_definition ⇒ Proc
61 62 63 |
# File 'lib/simple_jsonapi/serializer.rb', line 61 def id_definition definition.id_definition end |
#link_definitions ⇒ Hash{Symbol => String,Object}
81 82 83 |
# File 'lib/simple_jsonapi/serializer.rb', line 81 def link_definitions definition.link_definitions end |
#meta_definitions ⇒ Hash{Symbol => String,Object}
86 87 88 |
# File 'lib/simple_jsonapi/serializer.rb', line 86 def definition. end |
#relationship_definitions ⇒ Hash{Symbol => Relationship}
76 77 78 |
# File 'lib/simple_jsonapi/serializer.rb', line 76 def relationship_definitions definition.relationship_definitions end |
#type_definition ⇒ Proc
66 67 68 |
# File 'lib/simple_jsonapi/serializer.rb', line 66 def type_definition definition.type_definition end |