aboutsummaryrefslogtreecommitdiffstats
path: root/app/models/export_service.rb
blob: 2dbe0d7b38e3d6c7fd47569003ecc8f2ec5c71b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
class ExportService
  
  attr_reader :referential
  
  def initialize(referential)
    @referential = referential
  end

  # Find an export whith his id
  def find(id)
    Export.new( Ievkit.scheduled_job(referential.slug, id, { :action => "exporter" }) )
  end

  # Find all exports
  def all
    [].tap do |jobs|
      Ievkit.jobs(referential.slug, { :action => "exporter" }).each do |job|
        jobs << Export.new( job )
      end
    end
  end

end