Class: Almodovar::ResourcePresenter::Link::JsonSerializer

Inherits:
Serializer
  • Object
show all
Defined in:
lib/almodovar-server/resource_presenter/link.rb

Instance Attribute Summary

Attributes inherited from Serializer

#link, #options

Instance Method Summary collapse

Methods inherited from Serializer

#dont_expand_link!, #expands?, #initialize

Constructor Details

This class inherits a constructor from Almodovar::ResourcePresenter::Link::Serializer

Instance Method Details

#as_jsonObject



86
87
88
89
90
91
# File 'lib/almodovar-server/resource_presenter/link.rb', line 86

def as_json
  ActiveSupport::OrderedHash.new.tap do |message|
    message["#{link.rel}_link"] = link.href
    message[link.rel] = expand_resource if expands?
  end
end