Class: Shaf::ALPS::RelationSerializer
- Inherits:
-
Object
- Object
- Shaf::ALPS::RelationSerializer
- Defined in:
- lib/shaf/alps/relation_serializer.rb
Constant Summary collapse
- SAFE_METHODS =
['GET', 'HEAD', 'OPTIONS']
- IDEMPOTENT_METHODS =
['PUT', 'PATCH', 'DELETE']
- UNSAFE_METHODS =
['POST']
Instance Attribute Summary collapse
-
#rel ⇒ Object
readonly
Returns the value of attribute rel.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(rel) ⇒ RelationSerializer
constructor
A new instance of RelationSerializer.
- #to_hash ⇒ Object
Constructor Details
#initialize(rel) ⇒ RelationSerializer
Returns a new instance of RelationSerializer.
16 17 18 |
# File 'lib/shaf/alps/relation_serializer.rb', line 16 def initialize(rel) @rel = rel end |
Instance Attribute Details
#rel ⇒ Object (readonly)
Returns the value of attribute rel.
10 11 12 |
# File 'lib/shaf/alps/relation_serializer.rb', line 10 def rel @rel end |
Class Method Details
.call(arg) ⇒ Object
12 13 14 |
# File 'lib/shaf/alps/relation_serializer.rb', line 12 def self.call(arg) new(arg).to_hash end |
Instance Method Details
#to_hash ⇒ Object
20 21 22 23 24 25 |
# File 'lib/shaf/alps/relation_serializer.rb', line 20 def to_hash { id: rel.id, type: type, }.merge(optional_properties) end |