Class: Arcp::Job::Cancel

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#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/cancel.rb', line 5

def job_id
  @job_id
end

#reasonObject (readonly)

Returns the value of attribute reason

Returns:

  • (Object)

    the current value of reason



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

def reason
  @reason
end

Class Method Details

.from_h(h) ⇒ Object



6
7
8
9
# File 'lib/arcp/job/cancel.rb', line 6

def self.from_h(h)
  h = h.transform_keys(&:to_s)
  new(job_id: h.fetch('job_id'), reason: h['reason'])
end

Instance Method Details

#to_hObject



11
12
13
14
15
# File 'lib/arcp/job/cancel.rb', line 11

def to_h
  out = { 'job_id' => job_id }
  out['reason'] = reason if reason
  out
end