class HyperResource::Adapter

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.

Public Class Methods

apply(response, resource, opts={}) click to toggle source

Use a given deserialized response object (Hash) to update a given resource (HyperResource), returning the updated resource.

# 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) click to toggle source

Deserialize a given string into an object (Hash).

# 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) click to toggle source

Serialize the given object into a string.

# 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