afimb/chouette2

View on GitHub
app/models/import_service.rb

Summary

Maintainability
A
0 mins
Test Coverage
class ImportService

  attr_reader :referential
  
  def initialize( referential )
    @referential = referential
  end

  # Find an import whith his id
  def find(id)
    Import.new( Ievkitdeprecated.scheduled_job(referential.slug, id, { :action => "importer" }) )
  end

  # Find all imports
  def all
    [].tap do |jobs|
      Ievkitdeprecated.jobs(referential.slug, { :action => "importer" }).each do |job|
        jobs << Import.new( job )
      end
    end
  end
  
end