Class: Daengine::ContentServiceProcessor

Inherits:
Object
  • Object
show all
Defined in:
lib/daengine/content_service_processor.rb

Class Method Summary collapse

Class Method Details

.process_orderableObject



4
5
6
7
8
9
# File 'lib/daengine/content_service_processor.rb', line 4

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

.set_orderable(da, cs) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/daengine/content_service_processor.rb', line 11

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