lib/daengine/content_service_processor.rb in daengine-0.4.9 vs lib/daengine/content_service_processor.rb in daengine-0.5.0

- old
+ new

@@ -1,25 +1,25 @@ -module Daengine - class ContentServiceProcessor - - def self.process_orderable - result = DigitalAsset.all - ContentServiceResource.site = Daengine.config[:content_service_url] # for some reason this doesn't work from the class itself - cs = ContentServiceResource.find_all - result.each{ |da| set_orderable(da,cs)} - end - - def self.set_orderable(da,cs) - cs.each do |c| - if da.sami_code == c.samiCode - da.orderable = c.orderable == 'true' - begin - da.save! - rescue Exception => e - p "unable to set orderable status for #{da.try(:primary_path)}, #{da.errors.try(:first)}" - end - break - end - end - end - end +module Daengine + class ContentServiceProcessor + + def self.process_orderable + result = DigitalAsset.all + ContentServiceResource.site = Daengine.config[:content_service_url] # for some reason this doesn't work from the class itself + cs = ContentServiceResource.find_all + result.each{ |da| set_orderable(da,cs)} + end + + def self.set_orderable(da,cs) + cs.each do |c| + if da.sami_code == c.samiCode + da.orderable = c.orderable == 'true' + begin + da.save! + rescue Exception => e + p "unable to set orderable status for #{da.try(:primary_path)}, #{da.errors.try(:first)}" + end + break + end + end + end + end end \ No newline at end of file