def initialize(name, repository_name, child_model, parent_model, options = {})
assert_kind_of 'name', name, Symbol
assert_kind_of 'repository_name', repository_name, Symbol
assert_kind_of 'child_model', child_model, String, Class
assert_kind_of 'parent_model', parent_model, String, Class
unless model_defined?(child_model) || model_defined?(parent_model)
raise 'at least one of child_model and parent_model must be a Model object'
end
if child_properties = options[:child_key]
assert_kind_of 'options[:child_key]', child_properties, Array
end
if parent_properties = options[:parent_key]
assert_kind_of 'options[:parent_key]', parent_properties, Array
end
@name = name
@repository_name = repository_name
@child_model = child_model
@child_properties = child_properties
@query = options.reject { |k,v| OPTIONS.include?(k) }
@parent_model = parent_model
@parent_properties = parent_properties
@options = options
if model_defined?(@child_model) && model_defined?(@parent_model)
child_key
end
end