lib/jss/api_object/extension_attribute.rb
# Return a REXML doc string for this ext attr, with the current values.
Return a REXML doc string for this ext attr, with the current values.
Return a REXML doc string for this ext attr with the current values .
def rest_xml
      ea = REXML::Element.new self.class::RSRC_OBJECT_KEY.to_s
      ea.add_element('name').text = @name
      ea.add_element('description').text = @description if @description
      ea.add_element('data_type').text = @data_type
      unless self.class == JSS::UserExtensionAttribute
        ea.add_element('inventory_display').text = @web_display if @web_display
        ea.add_element('recon_display').text = @recon_display if @recon_display
      end
      it = ea.add_element('input_type')
      it.add_element('type').text = @input_type
      case @input_type
      when INPUT_TYPE_POPUP
        pcs = it.add_element('popup_choices')
        @popup_choices.each { |pc| pcs.add_element('choice').text = pc } if @popup_choices.is_a? Array
      when INPUT_TYPE_LDAP
        it.add_element('attribute_mapping').text = @attribute_mapping
      when INPUT_TYPE_SCRIPT
        ea.add_element('enabled').text = @enabled ? 'true' : 'false'
        it.add_element('script').text = @script
        it.add_element('platform').text = @platform || 'Mac'
        it.add_element('scripting_language').text = @scripting_language if @scripting_language
      end
      doc = REXML::Document.new APIConnection::XML_HEADER
      doc << ea
      doc.to_s
    end
def rest_xml ea = REXML :: Element . new self . class :: RSRC_OBJECT_KEY . to_s ea . add_element ( 'name' ) . text = @name ea . add_element ( 'description' ) . text = @description if @description ea . add_element ( 'data_type' ) . text = @data_type unless self . class == JSS :: UserExtensionAttribute ea . add_element ( 'inventory_display' ) . text = @web_display if @web_display ea . add_element ( 'recon_display' ) . text = @recon_display if @recon_display end it = ea . add_element ( 'input_type' ) it . add_element ( 'type' ) . text = @input_type case @input_type when INPUT_TYPE_POPUP pcs = it . add_element ( 'popup_choices' ) @popup_choices . each { | pc | pcs . add_element ( 'choice' ) . text = pc } if @popup_choices . is_a? Array when INPUT_TYPE_LDAP it . add_element ( 'attribute_mapping' ) . text = @attribute_mapping when INPUT_TYPE_SCRIPT ea . add_element ( 'enabled' ) . text = @enabled ? 'true' : 'false' it . add_element ( 'script' ) . text = @script it . add_element ( 'platform' ) . text = @platform || 'Mac' it . add_element ( 'scripting_language' ) . text = @scripting_language if @scripting_language end doc = REXML :: Document . new APIConnection :: XML_HEADER doc << ea doc . to_s end
Return a REXML doc string for this ext attr, with the current values.
Return a REXML doc string for this ext attr with the current values .