Class: JSONAPI::ResourceSetOperationResult

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

Instance Attribute Summary collapse

Attributes inherited from OperationResult

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

Instance Method Summary collapse

Constructor Details

#initialize(code, resource_set, options = {}) ⇒ ResourceSetOperationResult

Returns a new instance of ResourceSetOperationResult.



44
45
46
47
48
# File 'lib/jsonapi/operation_result.rb', line 44

def initialize(code, resource_set, options = {})
  @resource_set = resource_set
  @pagination_params = options.fetch(:pagination_params, {})
  super(code, options)
end

Instance Attribute Details

#pagination_paramsObject

Returns the value of attribute pagination_params.



42
43
44
# File 'lib/jsonapi/operation_result.rb', line 42

def pagination_params
  @pagination_params
end

#resource_setObject

Returns the value of attribute resource_set.



42
43
44
# File 'lib/jsonapi/operation_result.rb', line 42

def resource_set
  @resource_set
end

Instance Method Details

#to_hash(serializer) ⇒ Object



50
51
52
53
54
55
56
57
58
# File 'lib/jsonapi/operation_result.rb', line 50

def to_hash(serializer)
  if serializer
    serializer.serialize_resource_set_to_hash_single(resource_set)
  else
    # :nocov:
    {}
    # :nocov:
  end
end