Class: JSONAPI::ResourcesSetOperationResult

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

Direct Known Subclasses

RelatedResourcesSetOperationResult

Instance Attribute Summary collapse

Attributes inherited from OperationResult

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

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of ResourcesSetOperationResult.



64
65
66
67
68
69
70
# File 'lib/jsonapi/operation_result.rb', line 64

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

Instance Attribute Details

#page_countObject

Returns the value of attribute page_count.



62
63
64
# File 'lib/jsonapi/operation_result.rb', line 62

def page_count
  @page_count
end

#pagination_paramsObject

Returns the value of attribute pagination_params.



62
63
64
# File 'lib/jsonapi/operation_result.rb', line 62

def pagination_params
  @pagination_params
end

#record_countObject

Returns the value of attribute record_count.



62
63
64
# File 'lib/jsonapi/operation_result.rb', line 62

def record_count
  @record_count
end

#resource_setObject

Returns the value of attribute resource_set.



62
63
64
# File 'lib/jsonapi/operation_result.rb', line 62

def resource_set
  @resource_set
end

Instance Method Details

#to_hash(serializer) ⇒ Object



72
73
74
75
76
77
78
79
80
# File 'lib/jsonapi/operation_result.rb', line 72

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