Method: JSS::Purchasable#purchasing_xml

Defined in:
lib/jss/api_object/purchasable.rb

#purchasing_xmlREXML::Element

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns A <purchasing> element to be included in the rest_xml of objects that mix-in this module.

Returns:

  • (REXML::Element)

    A <purchasing> element to be included in the rest_xml of objects that mix-in this module.



291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
# File 'lib/jss/api_object/purchasable.rb', line 291

def purchasing_xml
  purch = REXML::Element.new('purchasing')

  purch.add_element('applecare_id').text = @applecare_id
  purch.add_element('is_leased').text = @is_leased
  purch.add_element('is_purchased').text = @is_purchased.to_s
  purch.add_element('lease_expires_epoch').text = @lease_expires ? @lease_expires.to_jss_epoch : nil
  # Note, life expectancy can't be an empty xml element, it must be zero if emtpy.
  purch.add_element('life_expectancy').text = @life_expectancy ? @life_expectancy : 0
  purch.add_element('po_date_epoch').text = @po_date ? @po_date.to_jss_epoch : nil
  purch.add_element('po_number').text = @po_number
  purch.add_element('purchase_price').text = @purchase_price
  purch.add_element('purchasing_account').text = @purchasing_account
  purch.add_element('purchasing_contact').text = @purchasing_contact
  purch.add_element('vendor').text = @vendor
  purch.add_element('warranty_expires_epoch').text = @warranty_expires ? @warranty_expires.to_jss_epoch : nil
  return purch
end