lib/haveapi/fs/components/resource_dir.rb in haveapi-fs-0.8.0 vs lib/haveapi/fs/components/resource_dir.rb in haveapi-fs-0.9.0
- old
+ new
@@ -63,10 +63,26 @@
else
# The directory contents have not been loaded yet. We don't necessarily
# need to load it all, a single query should be sufficient.
begin
obj = @resource.show(id, meta: meta_params)
- [ResourceInstanceDir, obj]
+
+ case @resource.actions[:show].output_layout
+ when :object
+ [ResourceInstanceDir, obj]
+
+ when :hash
+ [ResourceInstanceDir, HaveAPI::Fs::HashWrapper.new(
+ @resource.instance_variable_get('@client'),
+ @resource.instance_variable_get('@api'),
+ @resource,
+ @resource.actions[:show],
+ obj.response
+ )]
+
+ else
+ fail "Unexpected layout '#{@resource.actions[:show].output_layout}'"
+ end
rescue HaveAPI::Client::ActionFailed
# Not found
end
end