Module: Transloadit::Response::Assembly
- Defined in:
- lib/transloadit/response/assembly.rb
Constant Summary collapse
- DEFAULT_RELOAD_TRIES =
600
Instance Method Summary collapse
- #aborted? ⇒ Boolean
- #cancel! ⇒ Object
- #canceled? ⇒ Boolean
- #completed? ⇒ Boolean
- #error? ⇒ Boolean
- #executing? ⇒ Boolean
- #finished? ⇒ Boolean
- #rate_limit? ⇒ Boolean
- #reload! ⇒ Object
- #reload_until_finished!(options = {}) ⇒ Object
- #replaying? ⇒ Boolean
- #uploading? ⇒ Boolean
- #wait_time ⇒ Object
Instance Method Details
#aborted? ⇒ Boolean
12 13 14 |
# File 'lib/transloadit/response/assembly.rb', line 12 def aborted? self["ok"] == "REQUEST_ABORTED" end |
#cancel! ⇒ Object
8 9 10 |
# File 'lib/transloadit/response/assembly.rb', line 8 def cancel! replace Transloadit::Request.new(self["assembly_ssl_url"]).delete end |
#canceled? ⇒ Boolean
16 17 18 |
# File 'lib/transloadit/response/assembly.rb', line 16 def canceled? self["ok"] == "ASSEMBLY_CANCELED" end |
#completed? ⇒ Boolean
20 21 22 |
# File 'lib/transloadit/response/assembly.rb', line 20 def completed? self["ok"] == "ASSEMBLY_COMPLETED" end |
#error? ⇒ Boolean
24 25 26 |
# File 'lib/transloadit/response/assembly.rb', line 24 def error? self["error"] != nil end |
#executing? ⇒ Boolean
28 29 30 |
# File 'lib/transloadit/response/assembly.rb', line 28 def executing? self["ok"] == "ASSEMBLY_EXECUTING" end |
#finished? ⇒ Boolean
36 37 38 |
# File 'lib/transloadit/response/assembly.rb', line 36 def finished? aborted? || canceled? || completed? || error? end |
#rate_limit? ⇒ Boolean
44 45 46 |
# File 'lib/transloadit/response/assembly.rb', line 44 def rate_limit? self["error"] == "RATE_LIMIT_REACHED" end |
#reload! ⇒ Object
4 5 6 |
# File 'lib/transloadit/response/assembly.rb', line 4 def reload! replace Transloadit::Request.new(self["assembly_ssl_url"]).get end |
#reload_until_finished!(options = {}) ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/transloadit/response/assembly.rb', line 54 def reload_until_finished!( = {}) tries = [:tries] || DEFAULT_RELOAD_TRIES tries.times do sleep 1 reload! return self if finished? end raise Transloadit::Exception::ReloadLimitReached end |
#replaying? ⇒ Boolean
32 33 34 |
# File 'lib/transloadit/response/assembly.rb', line 32 def self["ok"] == "ASSEMBLY_REPLAYING" end |
#uploading? ⇒ Boolean
40 41 42 |
# File 'lib/transloadit/response/assembly.rb', line 40 def uploading? self["ok"] == "ASSEMBLY_UPLOADING" end |
#wait_time ⇒ Object
48 49 50 |
# File 'lib/transloadit/response/assembly.rb', line 48 def wait_time self["info"]["retryIn"] || 0 end |