Module: Roar::Representer::JSON::HAL::Links
- Defined in:
- lib/roar/representer/json/hal.rb
Overview
Including this module in your representer will render and parse your embedded hyperlinks following the HAL specification: stateless.co/hal_specification.html
module SongRepresenter
include Roar::Representer::JSON
include Roar::Representer::JSON::HAL::Links
link :self { "http://self" }
end
Renders to
{"links":{"self":{"href":"http://self"}}}
Note that the HAL::Links module alone doesn’t prepend an underscore to links
. Use the JSON::HAL module for that.
Defined Under Namespace
Modules: ClassMethods, InstanceMethods, LinkArrayRepresenter, LinkCollectionRepresenter Classes: LinkArray
Class Method Summary collapse
Class Method Details
.included(base) ⇒ Object
108 109 110 111 112 113 114 |
# File 'lib/roar/representer/json/hal.rb', line 108 def self.included(base) base.class_eval do extend Links::ClassMethods # ::links_definition_options include Roar::Representer::Feature::Hypermedia include InstanceMethods end end |