Class: JsonApi::Parameters::Handlers::DefaultHandlers::BaseHandler
- Inherits:
-
Object
- Object
- JsonApi::Parameters::Handlers::DefaultHandlers::BaseHandler
- Defined in:
- lib/jsonapi_parameters/default_handlers/base_handler.rb
Direct Known Subclasses
NilRelationHandler, ToManyRelationHandler, ToOneRelationHandler
Instance Attribute Summary collapse
-
#included ⇒ Object
readonly
Returns the value of attribute included.
-
#relationship_key ⇒ Object
readonly
Returns the value of attribute relationship_key.
-
#relationship_value ⇒ Object
readonly
Returns the value of attribute relationship_value.
Class Method Summary collapse
Instance Method Summary collapse
- #find_included_object(related_id:, related_type:) ⇒ Object
-
#initialize(relationship_key, relationship_value, included) ⇒ BaseHandler
constructor
A new instance of BaseHandler.
Constructor Details
#initialize(relationship_key, relationship_value, included) ⇒ BaseHandler
Returns a new instance of BaseHandler.
12 13 14 15 16 |
# File 'lib/jsonapi_parameters/default_handlers/base_handler.rb', line 12 def initialize(relationship_key, relationship_value, included) @relationship_key = relationship_key @relationship_value = relationship_value @included = included end |
Instance Attribute Details
#included ⇒ Object (readonly)
Returns the value of attribute included.
6 7 8 |
# File 'lib/jsonapi_parameters/default_handlers/base_handler.rb', line 6 def included @included end |
#relationship_key ⇒ Object (readonly)
Returns the value of attribute relationship_key.
6 7 8 |
# File 'lib/jsonapi_parameters/default_handlers/base_handler.rb', line 6 def relationship_key @relationship_key end |
#relationship_value ⇒ Object (readonly)
Returns the value of attribute relationship_value.
6 7 8 |
# File 'lib/jsonapi_parameters/default_handlers/base_handler.rb', line 6 def relationship_value @relationship_value end |
Class Method Details
.call(key, val, included) ⇒ Object
8 9 10 |
# File 'lib/jsonapi_parameters/default_handlers/base_handler.rb', line 8 def self.call(key, val, included) new(key, val, included).handle end |
Instance Method Details
#find_included_object(related_id:, related_type:) ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/jsonapi_parameters/default_handlers/base_handler.rb', line 18 def find_included_object(related_id:, related_type:) included.find do |included_object_enum| included_object_enum[:id] && included_object_enum[:id] == && included_object_enum[:type] && included_object_enum[:type] == end end |