Class: Qyu::Status

Inherits:
Object
  • Object
show all
Defined in:
lib/qyu/models/enums/status.rb

Overview

Qyu::Status

Constant Summary collapse

COMPLETED =
'completed'
QUEUED =
'queued'
WORKING =
'working'
FAILED =
'failed'
INVALID_PAYLOAD =
'invalid_payload'

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id) ⇒ Status


16
17
18
# File 'lib/qyu/models/enums/status.rb', line 16

def initialize(id)
  @id = id
end

Class Method Details

.find(id) ⇒ Object


12
13
14
# File 'lib/qyu/models/enums/status.rb', line 12

def self.find(id)
  Qyu.store.find_task(id)
end

Instance Method Details

#completed?Boolean


25
26
27
# File 'lib/qyu/models/enums/status.rb', line 25

def completed?
  status == COMPLETED
end

#failed?Boolean


37
38
39
# File 'lib/qyu/models/enums/status.rb', line 37

def failed?
  status == FAILED
end

#invalid_payload?Boolean


41
42
43
# File 'lib/qyu/models/enums/status.rb', line 41

def invalid_payload?
  status == INVALID_PAYLOAD
end

#queued?Boolean


29
30
31
# File 'lib/qyu/models/enums/status.rb', line 29

def queued?
  status == QUEUED
end

#statusObject


20
21
22
23
# File 'lib/qyu/models/enums/status.rb', line 20

def status
  t = Qyu.store.find_task(@id)
  t['status']
end

#working?Boolean


33
34
35
# File 'lib/qyu/models/enums/status.rb', line 33

def working?
  status == WORKING
end