Class: HyperResource::Adapter
- Inherits:
-
Object
- Object
- HyperResource::Adapter
- Defined in:
- lib/hyper_resource/adapter.rb,
lib/hyper_resource/adapter/hal_json.rb
Overview
HyperResource::Adapter is the interface/abstract base class for adapters to different hypermedia formats (e.g., HAL+JSON). New adapters must implement the public methods of this class.
Direct Known Subclasses
Defined Under Namespace
Classes: HAL_JSON
Class Method Summary collapse
-
.apply(response, resource, opts = {}) ⇒ Object
Use a given deserialized response object (Hash) to update a given resource (HyperResource), returning the updated resource.
-
.deserialize(string) ⇒ Object
Deserialize a given string into an object (Hash).
-
.serialize(object) ⇒ Object
Serialize the given object into a string.
Class Method Details
.apply(response, resource, opts = {}) ⇒ Object
Use a given deserialized response object (Hash) to update a given resource (HyperResource), returning the updated resource.
24 25 26 27 |
# File 'lib/hyper_resource/adapter.rb', line 24 def apply(response, resource, opts={}) raise NotImplementedError, "This is an abstract method -- subclasses "+ "of HyperResource::Adapter must implement it." end |
.deserialize(string) ⇒ Object
Deserialize a given string into an object (Hash).
17 18 19 20 |
# File 'lib/hyper_resource/adapter.rb', line 17 def deserialize(string) raise NotImplementedError, "This is an abstract method -- subclasses "+ "of HyperResource::Adapter must implement it." end |
.serialize(object) ⇒ Object
Serialize the given object into a string.
11 12 13 14 |
# File 'lib/hyper_resource/adapter.rb', line 11 def serialize(object) raise NotImplementedError, "This is an abstract method -- subclasses "+ "of HyperResource::Adapter must implement it." end |