Class: JSONAPI::RelatedResourcesSetOperationResult

Inherits:
ResourcesSetOperationResult show all
Defined in:
lib/jsonapi/operation_result.rb

Instance Attribute Summary collapse

Attributes inherited from ResourcesSetOperationResult

#page_count, #pagination_params, #record_count

Attributes inherited from OperationResult

#code, #links, #meta, #options, #warnings

Instance Method Summary collapse

Constructor Details

#initialize(code, source_resource, type, resource_set, options = {}) ⇒ RelatedResourcesSetOperationResult

Returns a new instance of RelatedResourcesSetOperationResult.



86
87
88
89
90
# File 'lib/jsonapi/operation_result.rb', line 86

def initialize(code, source_resource, type, resource_set, options = {})
  @source_resource = source_resource
  @_type = type
  super(code, resource_set, options)
end

Instance Attribute Details

#_typeObject

Returns the value of attribute _type.



84
85
86
# File 'lib/jsonapi/operation_result.rb', line 84

def _type
  @_type
end

#resource_setObject

Returns the value of attribute resource_set.



84
85
86
# File 'lib/jsonapi/operation_result.rb', line 84

def resource_set
  @resource_set
end

#source_resourceObject

Returns the value of attribute source_resource.



84
85
86
# File 'lib/jsonapi/operation_result.rb', line 84

def source_resource
  @source_resource
end

Instance Method Details

#to_hash(serializer = nil) ⇒ Object



92
93
94
95
96
97
98
99
100
# File 'lib/jsonapi/operation_result.rb', line 92

def to_hash(serializer = nil)
  if serializer
    serializer.serialize_related_resource_set_to_hash_plural(resource_set, source_resource)
  else
    # :nocov:
    {}
    # :nocov:
  end
end