Class: Apiwork::Adapter::Wrapper::Collection::Base
- Defined in:
- lib/apiwork/adapter/wrapper/collection/base.rb
Overview
Base class for collection response wrappers.
Collection wrappers structure responses for index actions that return multiple records. Extend this class to customize how collections are wrapped in your API responses.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#meta ⇒ Hash
readonly
The meta for this wrapper.
-
#metadata ⇒ Hash
readonly
The metadata for this wrapper.
- #root_key ⇒ Object readonly
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(data, metadata, root_key, meta) ⇒ Base
constructor
A new instance of Base.
Methods inherited from Base
Constructor Details
#initialize(data, metadata, root_key, meta) ⇒ Base
Returns a new instance of Base.
50 51 52 53 54 55 |
# File 'lib/apiwork/adapter/wrapper/collection/base.rb', line 50 def initialize(data, , root_key, ) super(data) @metadata = @root_key = root_key @meta = end |
Instance Attribute Details
#meta ⇒ Hash (readonly)
The meta for this wrapper.
46 47 48 |
# File 'lib/apiwork/adapter/wrapper/collection/base.rb', line 46 def @meta end |
#metadata ⇒ Hash (readonly)
The metadata for this wrapper.
46 47 48 |
# File 'lib/apiwork/adapter/wrapper/collection/base.rb', line 46 attr_reader :meta, :metadata, :root_key |
#root_key ⇒ Object (readonly)
46 47 48 |
# File 'lib/apiwork/adapter/wrapper/collection/base.rb', line 46 attr_reader :meta, :metadata, :root_key |