Module: Rooftop::ResourceLinks

Defined in:
lib/rooftop/resource_links/link.rb,
lib/rooftop/resource_links/collection.rb,
lib/rooftop/resource_links/resource_links.rb

Defined Under Namespace

Classes: Collection, Link

Constant Summary collapse

"http://docs.rooftopcms.com/link_relations"

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/rooftop/resource_links/resource_links.rb', line 4

def self.included(base)
  # set up an attribute called resource_links, which is a collection of links
  # to other resources in the API.
  base.send(:after_find, ->(r) {
    if r.respond_to?(:"_links")
      r.resource_links = Rooftop::ResourceLinks::Collection.new(r._links)
    end
  })
end