Class: Core::Endpoint::BasicHandler::Associations::BelongsTo::Handler::Association
- Inherits:
-
Object
- Object
- Core::Endpoint::BasicHandler::Associations::BelongsTo::Handler::Association
- Includes:
- Io::Json::Grammar::Intermediate, Io::Json::Grammar::Resource
- Defined in:
- app/api/core/endpoint/basic_handler/associations/belongs_to.rb
Instance Method Summary collapse
- #actions(*args) ⇒ Object
- #call(object, options, stream) ⇒ Object
-
#initialize(endpoint_helper, children = nil) ⇒ Association
constructor
A new instance of Association.
- #merge(node) ⇒ Object
Constructor Details
#initialize(endpoint_helper, children = nil) ⇒ Association
Returns a new instance of Association.
28 29 30 31 |
# File 'app/api/core/endpoint/basic_handler/associations/belongs_to.rb', line 28 def initialize(endpoint_helper, children = nil) super(children) @endpoint_helper = endpoint_helper end |
Instance Method Details
#actions(*args) ⇒ Object
50 51 52 |
# File 'app/api/core/endpoint/basic_handler/associations/belongs_to.rb', line 50 def actions(*args) # Nothing needed here! end |
#call(object, options, stream) ⇒ Object
41 42 43 44 45 46 47 48 |
# File 'app/api/core/endpoint/basic_handler/associations/belongs_to.rb', line 41 def call(object, , stream) @endpoint_helper.call(object) do |json_root, endpoint, associated_object| stream.block(json_root) do |nested_stream| resource_details(endpoint.instance_handler, associated_object, , stream) super(object, , nested_stream) end end end |
#merge(node) ⇒ Object
35 36 37 38 39 |
# File 'app/api/core/endpoint/basic_handler/associations/belongs_to.rb', line 35 def merge(node) super(node) do |children| self.class.new(@endpoint_helper, children) # prettier-ignore end end |