Class: Retab::HandlePayload

Inherits:
Types::BaseModel show all
Defined in:
lib/retab/workflow_steps/handle_payload.rb

Constant Summary collapse

HASH_ATTRS =
{
  type: :type,
  document: :document,
  data: :data,
  artifact_ref: :artifact_ref,
  preview: :preview
}.freeze

Instance Attribute Summary collapse

Attributes inherited from Types::BaseModel

#last_response

Instance Method Summary collapse

Methods inherited from Types::BaseModel

#inspect, normalize, #to_h, #to_json

Constructor Details

#initialize(json) ⇒ HandlePayload

Returns a new instance of HandlePayload.



23
24
25
26
27
28
29
30
# File 'lib/retab/workflow_steps/handle_payload.rb', line 23

def initialize(json)
  hash = self.class.normalize(json)
  @type = hash[:type]
  @document = hash[:document] ? Retab::FileRef.new(hash[:document]) : nil
  @data = hash[:data]
  @artifact_ref = hash[:artifact_ref] || {}
  @preview = hash[:preview] || {}
end

Instance Attribute Details

#artifact_refObject

Returns the value of attribute artifact_ref.



16
17
18
# File 'lib/retab/workflow_steps/handle_payload.rb', line 16

def artifact_ref
  @artifact_ref
end

#dataObject

Returns the value of attribute data.



16
17
18
# File 'lib/retab/workflow_steps/handle_payload.rb', line 16

def data
  @data
end

#documentObject

Returns the value of attribute document.



16
17
18
# File 'lib/retab/workflow_steps/handle_payload.rb', line 16

def document
  @document
end

#previewObject

Returns the value of attribute preview.



16
17
18
# File 'lib/retab/workflow_steps/handle_payload.rb', line 16

def preview
  @preview
end

#typeObject

Returns the value of attribute type.



16
17
18
# File 'lib/retab/workflow_steps/handle_payload.rb', line 16

def type
  @type
end