Class: JSONAPI::Document::Jsonapi
- Inherits:
-
NameValuePairCollection
- Object
- Collection
- NameValuePairCollection
- JSONAPI::Document::Jsonapi
- Defined in:
- lib/easy/jsonapi/document/jsonapi.rb,
lib/easy/jsonapi/document/jsonapi/jsonapi_member.rb
Overview
The jsonapi top level member of a JSON:API document
Defined Under Namespace
Classes: JsonapiMember
Instance Method Summary collapse
-
#add(jsonapi_member) ⇒ Object
Add a jsonapi member to the collection.
-
#initialize(jsonapi_member_arr = []) ⇒ Jsonapi
constructor
A new instance of Jsonapi.
Methods inherited from NameValuePairCollection
Methods inherited from Collection
#[], #[]=, #each, #empty?, #get, #include?, #insert, #keys, #remove, #set, #size, #to_s
Constructor Details
#initialize(jsonapi_member_arr = []) ⇒ Jsonapi
Returns a new instance of Jsonapi.
14 15 16 |
# File 'lib/easy/jsonapi/document/jsonapi.rb', line 14 def initialize(jsonapi_member_arr = []) super(jsonapi_member_arr, item_type: JSONAPI::Document::Jsonapi::JsonapiMember) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class JSONAPI::NameValuePairCollection
Instance Method Details
#add(jsonapi_member) ⇒ Object
Add a jsonapi member to the collection
20 21 22 |
# File 'lib/easy/jsonapi/document/jsonapi.rb', line 20 def add(jsonapi_member) super(jsonapi_member, &:name) end |