lib/jss/api_object/peripheral.rb
###
### Return the REST XML for this pkg, with the current values,
### for saving or updating
###
Return the REST XML for this pkg, with the current values,
for saving or updating
Return the REST XML for this pkg with the current values for saving or updating
def rest_xml
      doc = REXML::Document.new APIConnection::XML_HEADER
      periph = doc.add_element RSRC_OBJECT_KEY.to_s
      general = periph.add_element('general')
      general.add_element('type').text = @type
      general.add_element('site').add_element('name').text = @site
      general.add_element('bar_code_1').text = @bar_code_1
      general.add_element('bar_code_2').text = @bar_code_2
      general.add_element('computer_id').text = @computer_id
      fields = general.add_element('fields')
      @fields.each do |n,v|
        fld =  fields.add_element('field')
        fld.add_element('name').text = n
        fld.add_element('value').text = v
      end
      if has_location?
        periph << location_xml
      end
      if has_purchasing?
        periph << purchasing_xml
      end
      add_site_to_xml doc
      return doc.to_s
    end
def rest_xml doc = REXML :: Document . new APIConnection :: XML_HEADER periph = doc . add_element RSRC_OBJECT_KEY . to_s general = periph . add_element ( 'general' ) general . add_element ( 'type' ) . text = @type general . add_element ( 'site' ) . add_element ( 'name' ) . text = @site general . add_element ( 'bar_code_1' ) . text = @bar_code_1 general . add_element ( 'bar_code_2' ) . text = @bar_code_2 general . add_element ( 'computer_id' ) . text = @computer_id fields = general . add_element ( 'fields' ) @fields . each do | n , v | fld = fields . add_element ( 'field' ) fld . add_element ( 'name' ) . text = n fld . add_element ( 'value' ) . text = v end if has_location? periph << location_xml end if has_purchasing? periph << purchasing_xml end add_site_to_xml doc return doc . to_s end
Return the REST XML for this pkg, with the current values,
for saving or updating
Return the REST XML for this pkg with the current values for saving or updating