Class: Replicate::Record::Prediction

Inherits:
Base
  • Object
show all
Defined in:
lib/replicate/record/prediction.rb

Instance Attribute Summary

Attributes inherited from Base

#client, #data

Instance Method Summary collapse

Methods inherited from Base

#initialize, #inspect, #method_missing

Constructor Details

This class inherits a constructor from Replicate::Record::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Replicate::Record::Base

Instance Method Details

#cancelObject



10
11
12
# File 'lib/replicate/record/prediction.rb', line 10

def cancel
  @data = client.cancel_prediction(id).data
end

#canceled?Boolean

Returns:

  • (Boolean)


39
40
41
# File 'lib/replicate/record/prediction.rb', line 39

def canceled?
  status == "canceled"
end

#failed?Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/replicate/record/prediction.rb', line 35

def failed?
  status == "failed"
end

#finished?Boolean

Returns:

  • (Boolean)


14
15
16
17
18
19
20
21
# File 'lib/replicate/record/prediction.rb', line 14

def finished?
  case status
  when "succeeded", "failed", "canceled"
    true
  else
    false
  end
end

#processing?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/replicate/record/prediction.rb', line 27

def processing?
  status == "processing"
end

#refetchObject



6
7
8
# File 'lib/replicate/record/prediction.rb', line 6

def refetch
  @data = client.retrieve_prediction(id).data
end

#starting?Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/replicate/record/prediction.rb', line 23

def starting?
  status == "starting"
end

#succeeded?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'lib/replicate/record/prediction.rb', line 31

def succeeded?
  status == "succeeded"
end