Class: Ocs::Resources::AsyncJob

Inherits:
Base
  • Object
show all
Defined in:
lib/ocs/resources/async_job.rb

Constant Summary

Constants inherited from Base

Base::BOOLEAN

Instance Attribute Summary

Attributes inherited from Base

#client, #error

Instance Method Summary collapse

Methods inherited from Base

all, downcased_name, find, inherited, #initialize, list, name, pluralized_name, underscored_name, where

Methods included from DynamicDefiners

#alias_attribute, #define_action, #define_attribute, #delegate_attribute, #delegate_attributes, #has_many, #has_one

Constructor Details

This class inherits a constructor from Ocs::Resources::Base

Instance Method Details

#done?Boolean

Returns:

  • (Boolean)


7
8
9
10
# File 'lib/ocs/resources/async_job.rb', line 7

def done?
  reload!
  jobstatus != 0
end

#failed?Boolean

Returns:

  • (Boolean)


12
13
14
15
# File 'lib/ocs/resources/async_job.rb', line 12

def failed?
  reload!
  jobstatus == 2
end

#reload!Object



22
23
24
25
# File 'lib/ocs/resources/async_job.rb', line 22

def reload!
  res = client.call("queryAsyncJobResult", jobid: jobid)
  self.jobstatus = res[:jobstatus]
end

#success?Boolean

Returns:

  • (Boolean)


17
18
19
20
# File 'lib/ocs/resources/async_job.rb', line 17

def success?
  reload!
  jobstatus == 1
end