class HaveAPI::Fs::Components::ResourceActionDir
Attributes
resource[R]
Public Class Methods
new(r)
click to toggle source
Calls superclass method
HaveAPI::Fs::Component::new
# File lib/haveapi/fs/components/resource_action_dir.rb, line 6 def initialize(r) @resource = r @instance = r.is_a?(HaveAPI::Client::ResourceInstance) || r.is_a?(HaveAPI::Fs::HashWrapper) super() end
Public Instance Methods
contents()
click to toggle source
Calls superclass method
HaveAPI::Fs::Components::Directory#contents
# File lib/haveapi/fs/components/resource_action_dir.rb, line 13 def contents super + relevant_actions.map(&:to_s) end
instance?()
click to toggle source
# File lib/haveapi/fs/components/resource_action_dir.rb, line 37 def instance? @instance end
relevant_actions()
click to toggle source
# File lib/haveapi/fs/components/resource_action_dir.rb, line 17 def relevant_actions return @actions if @actions @actions = [] @resource.actions.each do |name, a| pos = a.url.index(":#{@resource._name}_id") if @instance cond = pos else cond = pos.nil? end @actions << name if cond end @actions end
title()
click to toggle source
# File lib/haveapi/fs/components/resource_action_dir.rb, line 41 def title 'Actions' end
Protected Instance Methods
new_child(name)
click to toggle source
Calls superclass method
HaveAPI::Fs::Components::Directory#new_child
# File lib/haveapi/fs/components/resource_action_dir.rb, line 46 def new_child(name) if child = super child elsif @resource.actions.has_key?(name) klass = case name when :create CreateActionDir when :update instance? ? UpdateActionDir : ActionDir when :delete DeleteActionDir else ActionDir end [klass, @resource, @resource.actions[name]] else nil end end