Class: Apiwork::Adapter::Capability::Transformer::Response::Base
- Inherits:
-
Object
- Object
- Apiwork::Adapter::Capability::Transformer::Response::Base
- Defined in:
- lib/apiwork/adapter/capability/transformer/response/base.rb
Overview
Base class for response transformers.
Response transformers modify responses before they are returned. Register transformers in capabilities using Base.response_transformer.
Instance Attribute Summary collapse
- #response ⇒ Object readonly
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(response) ⇒ Base
constructor
A new instance of Base.
-
#transform ⇒ Response
Transforms the response.
Constructor Details
#initialize(response) ⇒ Base
Returns a new instance of Base.
29 30 31 |
# File 'lib/apiwork/adapter/capability/transformer/response/base.rb', line 29 def initialize(response) @response = response end |
Instance Attribute Details
#response ⇒ Object (readonly)
21 22 23 |
# File 'lib/apiwork/adapter/capability/transformer/response/base.rb', line 21 def response @response end |
Class Method Details
.transform(response) ⇒ Object
24 25 26 |
# File 'lib/apiwork/adapter/capability/transformer/response/base.rb', line 24 def transform(response) new(response).transform end |
Instance Method Details
#transform ⇒ Response
Transforms the response.
37 38 39 |
# File 'lib/apiwork/adapter/capability/transformer/response/base.rb', line 37 def transform raise NotImplementedError end |