module PIM::CommunicationChannels

Public Instance Methods

all_communication_channels() click to toggle source
# File pim.rb, line 9661
def all_communication_channels
  channels = {}
  channels.merge!(@module_communication_channels) if @module_communication_channels
  add_parent_objects(channels) { |p| p.module_communication_channels }
  channels
end
communication_channel(name, type = nil, plan = nil, &block) click to toggle source
# File pim.rb, line 9612
def communication_channel name, type = nil, plan = nil, &block

  name = to_sym(name)
  if type or plan or block

    channel = PIM::CommunicationChannel.new name, type, plan
    channel.instance_exec(&block) if block
    add_communication_channel(channel)
    channel

  elsif name.is_a? PIM::CommunicationChannel
    channel
  else
    all_communication_channels[name]
  end

end
communication_channel_from_template(template_name, name = nil, &block) click to toggle source
# File pim.rb, line 9630
def communication_channel_from_template template_name, name = nil, &block

  template_channel = get_communication_channel_template(template_name) if ::Object.private_method_defined?(:get_communication_channel_template)
  return nil if template_channel.nil?

  name ||= template_channel.name
  type = template_channel.type.to_s
  plan = template_channel.plan
  new_channel = PIM::CommunicationChannel.new name, type, plan

  # Add channel type specific values
  channel_properties = PIM::CHANNEL_PROPERTIES[type]
  if channel_properties
    channel_properties.each do |property|
      property = PIM.to_sym(property)
      value = template_channel.send(property) if template_channel.respond_to?(property)
      new_channel.channel_value(property, value)
    end
  end

  # Add plan values
  template_channel.plan_values.each do |key, value|
    new_channel.plan_value key, value
  end

  new_channel.instance_exec(&block) if block
  add_communication_channel(new_channel)
  new_channel

end
communication_channels_as_json() click to toggle source
# File pim.rb, line 9672
def communication_channels_as_json
  as_json(Hash[all_communication_channels.sort])
end
module_communication_channels() click to toggle source
# File pim.rb, line 9668
def module_communication_channels
  @module_communication_channels ||= {}
end