Class: JSONAPI::RelationshipOperationResult
- Inherits:
-
OperationResult
- Object
- OperationResult
- JSONAPI::RelationshipOperationResult
- Defined in:
- lib/jsonapi/operation_result.rb
Instance Attribute Summary collapse
-
#parent_resource ⇒ Object
Returns the value of attribute parent_resource.
-
#relationship ⇒ Object
Returns the value of attribute relationship.
-
#resource_ids ⇒ Object
Returns the value of attribute resource_ids.
Attributes inherited from OperationResult
#code, #links, #meta, #options, #warnings
Instance Method Summary collapse
-
#initialize(code, parent_resource, relationship, resource_ids, options = {}) ⇒ RelationshipOperationResult
constructor
A new instance of RelationshipOperationResult.
- #to_hash(serializer = nil) ⇒ Object
Constructor Details
#initialize(code, parent_resource, relationship, resource_ids, options = {}) ⇒ RelationshipOperationResult
Returns a new instance of RelationshipOperationResult.
106 107 108 109 110 111 |
# File 'lib/jsonapi/operation_result.rb', line 106 def initialize(code, parent_resource, relationship, resource_ids, = {}) @parent_resource = parent_resource @relationship = relationship @resource_ids = resource_ids super(code, ) end |
Instance Attribute Details
#parent_resource ⇒ Object
Returns the value of attribute parent_resource.
104 105 106 |
# File 'lib/jsonapi/operation_result.rb', line 104 def parent_resource @parent_resource end |
#relationship ⇒ Object
Returns the value of attribute relationship.
104 105 106 |
# File 'lib/jsonapi/operation_result.rb', line 104 def relationship @relationship end |
#resource_ids ⇒ Object
Returns the value of attribute resource_ids.
104 105 106 |
# File 'lib/jsonapi/operation_result.rb', line 104 def resource_ids @resource_ids end |
Instance Method Details
#to_hash(serializer = nil) ⇒ Object
113 114 115 116 117 118 119 120 121 |
# File 'lib/jsonapi/operation_result.rb', line 113 def to_hash(serializer = nil) if serializer serializer.serialize_to_relationship_hash(parent_resource, relationship, resource_ids) else # :nocov: {} # :nocov: end end |