Class: RunApi::Core::TaskResponse

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/runapi/core/types.rb

Overview

Typed response structure for async task operations. Additional API-specific fields are preserved and exposed via dot notation.

Defined Under Namespace

Modules: Status

Instance Attribute Summary collapse

Method Summary

Methods inherited from BaseModel

#==, #[], coerce, #dig, fields, from_hash, #initialize, optional, required, #to_h

Constructor Details

This class inherits a constructor from RunApi::Core::BaseModel

Instance Attribute Details

#dataRunApi::Core::DynamicModel? (readonly)

Returns Task-specific result data.

Returns:



112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/runapi/core/types.rb', line 112

class TaskResponse < BaseModel
  module Status
    PENDING = "pending"
    PROCESSING = "processing"
    COMPLETED = "completed"
    FAILED = "failed"

    ALL = [ PENDING, PROCESSING, COMPLETED, FAILED ].freeze
  end

  optional :id, String
  optional :status, String
  optional :error, String
  optional :data, -> { DynamicModel }
end

#errorString? (readonly)

Returns Error message if task failed.

Returns:

  • (String, nil)

    Error message if task failed.



112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/runapi/core/types.rb', line 112

class TaskResponse < BaseModel
  module Status
    PENDING = "pending"
    PROCESSING = "processing"
    COMPLETED = "completed"
    FAILED = "failed"

    ALL = [ PENDING, PROCESSING, COMPLETED, FAILED ].freeze
  end

  optional :id, String
  optional :status, String
  optional :error, String
  optional :data, -> { DynamicModel }
end

#idString? (readonly)

Returns Task ID for tracking and retrieval.

Returns:

  • (String, nil)

    Task ID for tracking and retrieval.



112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/runapi/core/types.rb', line 112

class TaskResponse < BaseModel
  module Status
    PENDING = "pending"
    PROCESSING = "processing"
    COMPLETED = "completed"
    FAILED = "failed"

    ALL = [ PENDING, PROCESSING, COMPLETED, FAILED ].freeze
  end

  optional :id, String
  optional :status, String
  optional :error, String
  optional :data, -> { DynamicModel }
end

#statusString? (readonly)

Returns Current task status.

Returns:

  • (String, nil)

    Current task status.



112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/runapi/core/types.rb', line 112

class TaskResponse < BaseModel
  module Status
    PENDING = "pending"
    PROCESSING = "processing"
    COMPLETED = "completed"
    FAILED = "failed"

    ALL = [ PENDING, PROCESSING, COMPLETED, FAILED ].freeze
  end

  optional :id, String
  optional :status, String
  optional :error, String
  optional :data, -> { DynamicModel }
end