class AdobeConnect::AclField

Public: Represents a Custom Field object inside of Connect.

Attributes

id[RW]
name[RW]
obj_type[RW]
service[RW]

Public Class Methods

config() click to toggle source
Calls superclass method
# File lib/adobe_connect/acl_field.rb, line 27
def self.config
  super.merge({ :ac_obj_type => 'field', :ac_method_prefix => 'custom_field' })
end
find_or_create(name, obj_type, service = AdobeConnect::Service.new) click to toggle source

Public: Find a folder on the current Connect instance.

name, obj_type, service - see attrs for description

Returns a new AdobeConnect::AclField object.

# File lib/adobe_connect/acl_field.rb, line 36
def self.find_or_create(name, obj_type, service = AdobeConnect::Service.new)
  response = service.custom_fields(:filter_name => name)
  c_flds = response.at_xpath('//custom-fields').children

  if c_flds.count.zero?
    #Create
    fld = self.new({ :name => name, :obj_type => obj_type }, service)
    fld.save
  else
    fld = load_from_xml(c_flds[0])
  end

  fld
end

Private Class Methods

load_from_xml(ac_field, service) click to toggle source
# File lib/adobe_connect/acl_field.rb, line 52
def self.load_from_xml(ac_field, service)
  self.new({
      :id => ac_field.attr('field-id'),
      :name => ac_field.at_xpath('//name').text,
      :obj_type => ac_field.attr('obj_type')
    }, service)
end

Public Instance Methods

attrs() click to toggle source

id - The Field-ID of the custom field object. name - The name of the Field. obj_type- The type of Connect Object this applies to. Allowed values

are: principal, meeting, sco, event, read-only
# File lib/adobe_connect/acl_field.rb, line 13
def attrs
  atrs = {
    :object_type => "object-type-#{obj_type}", :permission_id => 'manage',
    :name => name, :field_type => 'text', :is_required => false,
    :is_primary => true
  }

  if !id.nil?
    atrs.merge!(:field_id => id)
  end

  atrs
end