Class: ImageToVideoAI::Task
- Inherits:
-
Object
- Object
- ImageToVideoAI::Task
- Defined in:
- lib/image_to_video_ai/client.rb
Constant Summary collapse
- TERMINAL_STATUSES =
%w[success failed canceled].freeze
Instance Attribute Summary collapse
-
#request_id ⇒ Object
readonly
Returns the value of attribute request_id.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#task_id ⇒ Object
readonly
Returns the value of attribute task_id.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
-
#videos ⇒ Object
readonly
Returns the value of attribute videos.
Instance Method Summary collapse
- #complete? ⇒ Boolean
-
#initialize(data) ⇒ Task
constructor
A new instance of Task.
- #successful? ⇒ Boolean
Constructor Details
#initialize(data) ⇒ Task
Returns a new instance of Task.
25 26 27 28 29 30 31 |
# File 'lib/image_to_video_ai/client.rb', line 25 def initialize(data) @task_id = data.fetch("taskId") @request_id = data["requestId"] @status = data.fetch("status") @url = data["url"] @videos = data["videos"] || [] end |
Instance Attribute Details
#request_id ⇒ Object (readonly)
Returns the value of attribute request_id.
23 24 25 |
# File 'lib/image_to_video_ai/client.rb', line 23 def request_id @request_id end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
23 24 25 |
# File 'lib/image_to_video_ai/client.rb', line 23 def status @status end |
#task_id ⇒ Object (readonly)
Returns the value of attribute task_id.
23 24 25 |
# File 'lib/image_to_video_ai/client.rb', line 23 def task_id @task_id end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
23 24 25 |
# File 'lib/image_to_video_ai/client.rb', line 23 def url @url end |
#videos ⇒ Object (readonly)
Returns the value of attribute videos.
23 24 25 |
# File 'lib/image_to_video_ai/client.rb', line 23 def videos @videos end |
Instance Method Details
#complete? ⇒ Boolean
33 34 35 |
# File 'lib/image_to_video_ai/client.rb', line 33 def complete? TERMINAL_STATUSES.include?(status) end |
#successful? ⇒ Boolean
37 38 39 |
# File 'lib/image_to_video_ai/client.rb', line 37 def successful? status == "success" end |