383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
|
# File 'lib/kaltura_client_base.rb', line 383
def self.object_from_xml(xml_element)
instance = nil
if xml_element.elements.size > 0
if xml_element.elements[1].name == 'item' instance = []
xml_element.elements.each('item') do | element |
instance.push(KalturaClassFactory.object_from_xml(element))
end
else object_type_element = xml_element.get_text('objectType')
if (object_type_element != nil)
object_class = xml_element.get_text('objectType').value.to_s
instance = Module.const_get("Kaltura")
instance = instance.const_get(object_class).new
xml_element.elements.each do | element |
value = KalturaClassFactory.object_from_xml(element)
instance.send(self.underscore(element.name) + "=", value) if instance.class.method_defined?(self.underscore(element.name));
end
else error_element = xml_element.elements['error']
if (error_element != nil)
code = xml_element.elements["error/code"].text
message = xml_element.elements["error/message"].text
instance = KalturaAPIError.new(code, message)
end
end
end
else return xml_element.text
end
return instance;
end
|