Sha256: e4b8b470c9799452bb65c2a63f6ec2fa1a931ae287f551e9c7377b3369594075
Contents?: true
Size: 1.35 KB
Versions: 3
Compression:
Stored size: 1.35 KB
Contents
module HaveAPI::Fs::Components class ActionOutput < Directory component :action_output attr_reader :action_dir attr_accessor :data def initialize(action_dir, *args) super(*args) @action_dir = action_dir if %i(hash_list object_list).include?(@action_dir.action.output_layout.to_sym) @list = true end end def contents ret = super return ret unless @data if @list ret.concat(@data.map { |v| v.id.to_s }) else ret.concat(parameters.keys.map(&:to_s)) end ret end def parameters @action_dir.action.params end def title 'Output parameters' end protected def new_child(name) if child = super child elsif !@data nil elsif @list id = name.to_s.to_i if @data.is_a?(HaveAPI::Client::ResourceInstanceList) param = @data.detect { |v| v.id == id } [ResourceInstanceDir, param] else param = @data.response.detect { |v| v[:id] == id } [ListItem, @action_dir.action, :output, param] end elsif parameters.has_key?(name) [ Parameter, @action_dir.action, name, :output, @data, ] else nil end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
haveapi-fs-0.11.0 | lib/haveapi/fs/components/action_output.rb |
haveapi-fs-0.10.0 | lib/haveapi/fs/components/action_output.rb |
haveapi-fs-0.9.0 | lib/haveapi/fs/components/action_output.rb |