Class: JSONAPI::Resource
- Inherits:
-
Object
- Object
- JSONAPI::Resource
- Includes:
- JSONAPI::Resources::AttributesDsl, JSONAPI::Resources::FiltersDsl, JSONAPI::Resources::MetaDsl, JSONAPI::Resources::ModelClassHelpers, JSONAPI::Resources::RelationshipsDsl, JSONAPI::Resources::SortableFieldsDsl
- Defined in:
- lib/json_api/resources/resource.rb
Direct Known Subclasses
Class Attribute Summary collapse
-
.type_format ⇒ Object
Returns the value of attribute type_format.
Instance Attribute Summary collapse
-
#record ⇒ Object
(also: #resource)
readonly
Returns the value of attribute record.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(record = nil, context = {}) ⇒ Resource
constructor
A new instance of Resource.
- #transformed_params ⇒ Object
Constructor Details
#initialize(record = nil, context = {}) ⇒ Resource
Returns a new instance of Resource.
28 29 30 31 32 |
# File 'lib/json_api/resources/resource.rb', line 28 def initialize(record = nil, context = {}) @record = record @context = context @transformed_params = {} end |
Class Attribute Details
.type_format ⇒ Object
Returns the value of attribute type_format.
20 21 22 |
# File 'lib/json_api/resources/resource.rb', line 20 def type_format @type_format end |
Instance Attribute Details
#record ⇒ Object (readonly) Also known as: resource
Returns the value of attribute record.
34 35 36 |
# File 'lib/json_api/resources/resource.rb', line 34 def record @record end |
Class Method Details
.inherited(subclass) ⇒ Object
22 23 24 25 |
# File 'lib/json_api/resources/resource.rb', line 22 def inherited(subclass) super subclass.type_format = type_format end |
Instance Method Details
#transformed_params ⇒ Object
37 38 39 |
# File 'lib/json_api/resources/resource.rb', line 37 def transformed_params @transformed_params || {} end |