Module: Imports::Status

Included in:
Import
Defined in:
app/models/imports/status.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object

Import status transitions:

pending -> approved -> imported


6
7
8
9
10
# File 'app/models/imports/status.rb', line 6

def self.included(base)
  base.class_eval do
    attr_accessible :status
  end
end

Instance Method Details

#approve!Object



23
24
25
26
# File 'app/models/imports/status.rb', line 23

def approve!
  self.update_column(:status,"approved")
  Delayed::Job.enqueue self
end

#caching!Object



13
14
15
16
17
# File 'app/models/imports/status.rb', line 13

def caching!
  save if new_record?
  self.update_column(:status, "caching")
  Delayed::Job.enqueue self
end

#failed!Object



48
49
50
# File 'app/models/imports/status.rb', line 48

def failed!
  self.update_column(:status, "failed")
end

#failed?Boolean

Returns:

  • (Boolean)


52
53
54
# File 'app/models/imports/status.rb', line 52

def failed?
  self.status == "failed"
end

#imported!Object



36
37
38
# File 'app/models/imports/status.rb', line 36

def imported!
  self.update_column(:status, "imported")
end

#importing!Object



32
33
34
# File 'app/models/imports/status.rb', line 32

def importing!
  self.update_column(:status, "importing")
end

#invalidate!Object



28
29
30
# File 'app/models/imports/status.rb', line 28

def invalidate!
  self.update_column(:status, "invalid")
end

#pending!Object



19
20
21
# File 'app/models/imports/status.rb', line 19

def pending!
  self.update_column(:status, "pending")
end

#recalled!Object



44
45
46
# File 'app/models/imports/status.rb', line 44

def recalled!
  self.update_column(:status, "recalled")
end

#recalling!Object



40
41
42
# File 'app/models/imports/status.rb', line 40

def recalling!
  self.update_column(:status, "recalling")
end