Class: JSONAPI::Document::Links

Inherits:
NameValuePairCollection show all
Defined in:
lib/easy/jsonapi/document/links.rb,
lib/easy/jsonapi/document/links/link.rb

Overview

The links of a resource

Defined Under Namespace

Classes: Link

Instance Method Summary collapse

Methods inherited from NameValuePairCollection

#<<, #to_h, #to_s

Methods inherited from Collection

#[], #[]=, #each, #empty?, #get, #include?, #insert, #keys, #remove, #set, #size, #to_s

Constructor Details

#initialize(link_arr = []) ⇒ Links

Returns a new instance of Links.

Parameters:

  • link_arr (Array<JSONAPI::Document::Links::Link] The array of links to initialize this collection with.) (defaults to: [])

    ink_arr [Array<JSONAPI::Document::Links::Link] The array of links to initialize this collection with.



15
16
17
# File 'lib/easy/jsonapi/document/links.rb', line 15

def initialize(link_arr = [])
  super(link_arr, item_type: JSONAPI::Document::Links::Link)
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class JSONAPI::NameValuePairCollection

Instance Method Details

#add(link) ⇒ Object

Add a jsonapi member to the collection

Parameters:

  • link (JSONAPI::Document::Links:Link)

    The member to add



21
22
23
# File 'lib/easy/jsonapi/document/links.rb', line 21

def add(link)
  super(link, &:name)
end