-
Notifications
You must be signed in to change notification settings - Fork 9
Nested operation Inclusion
Vladislav Trotsenko edited this page Sep 30, 2019
·
1 revision
Provides JSON API inclusion of related resources. Dot-separated relationship path supporting not implemented at this time.
HTTP request example: GET /users?include=team,organization
Before using this nested operation you should set ctx[:available_inclusion_options]
with an array as available options.
module Api::V1::Lib::Operation
class Inclusion < ApplicationOperation
step :inclusion_query_param_passed?, Output(:failure) => End(:success)
step Macro::Contract::Schema(
Api::V1::Lib::Contract::InclusionValidation,
name: :uri_query,
inject: %i[available_inclusion_options]
)
step Contract::Validate(name: :uri_query)
step Macro::Assign(to: :inclusion_options, path: %w[contract.uri_query include])
end
end
RubyGarage is a leading software development and consulting company in Eastern Europe. Our main expertise includes Ruby and Ruby on Rails, but we successfully employ other technologies to deliver the best results to our clients. Check out our portfolio for even more exciting works!