Class: Arcp::Job::Result

Inherits:
Data
  • Object
show all
Defined in:
lib/arcp/job/result.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#completed_atObject (readonly)

Returns the value of attribute completed_at

Returns:

  • (Object)

    the current value of completed_at



5
6
7
# File 'lib/arcp/job/result.rb', line 5

def completed_at
  @completed_at
end

#final_statusObject (readonly)

Returns the value of attribute final_status

Returns:

  • (Object)

    the current value of final_status



5
6
7
# File 'lib/arcp/job/result.rb', line 5

def final_status
  @final_status
end

#job_idObject (readonly)

Returns the value of attribute job_id

Returns:

  • (Object)

    the current value of job_id



5
6
7
# File 'lib/arcp/job/result.rb', line 5

def job_id
  @job_id
end

#resultObject (readonly)

Returns the value of attribute result

Returns:

  • (Object)

    the current value of result



5
6
7
# File 'lib/arcp/job/result.rb', line 5

def result
  @result
end

#result_idObject (readonly)

Returns the value of attribute result_id

Returns:

  • (Object)

    the current value of result_id



5
6
7
# File 'lib/arcp/job/result.rb', line 5

def result_id
  @result_id
end

#result_sizeObject (readonly)

Returns the value of attribute result_size

Returns:

  • (Object)

    the current value of result_size



5
6
7
# File 'lib/arcp/job/result.rb', line 5

def result_size
  @result_size
end

Class Method Details

.from_h(h) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/arcp/job/result.rb', line 6

def self.from_h(h)
  h = h.transform_keys(&:to_s)
  new(
    job_id: h.fetch('job_id'),
    final_status: h.fetch('final_status'),
    result: h['result'],
    result_id: h['result_id'],
    result_size: h['result_size'],
    completed_at: h['completed_at']
  )
end

Instance Method Details

#chunked?Boolean

Returns:

  • (Boolean)


27
# File 'lib/arcp/job/result.rb', line 27

def chunked? = !result_id.nil?

#to_hObject



18
19
20
21
22
23
24
25
# File 'lib/arcp/job/result.rb', line 18

def to_h
  out = { 'job_id' => job_id, 'final_status' => final_status }
  out['result']       = result if result
  out['result_id']    = result_id if result_id
  out['result_size']  = result_size if result_size
  out['completed_at'] = completed_at if completed_at
  out
end