Class: Animoto::Resources::Jobs::Base Abstract
- Defined in:
- lib/animoto/resources/jobs/base.rb
Overview
This class is abstract.
Direct Known Subclasses
Directing, DirectingAndRendering, Rendering, StoryboardBundling, StoryboardUnbundling
Instance Attribute Summary collapse
-
#errors ⇒ Array<Animoto::Error>
readonly
Errors associated with this job.
-
#state ⇒ String
readonly
The state of this job.
-
#url ⇒ String
readonly
The URL for this job.
Class Method Summary collapse
- .endpoint(path = nil) ⇒ Object
- .infer_content_type ⇒ String
- .infer_endpoint ⇒ Object
- .unpack_standard_envelope(body) ⇒ Hash{Symbol=>Object}
Instance Method Summary collapse
-
#completed? ⇒ Boolean
Returns true if the state of this job is ‘completed’.
-
#failed? ⇒ Boolean
Returns true if the state of this job is ‘failed’.
- #instantiate(attributes = {}) ⇒ Jobs::Base
-
#pending? ⇒ Boolean
Returns true if the job is neither failed or completed.
Methods inherited from Base
#endpoint, #initialize, load, #load, new, original_new, register
Methods included from Support::StandardEnvelope
Constructor Details
This class inherits a constructor from Animoto::Resources::Base
Instance Attribute Details
#errors ⇒ Array<Animoto::Error> (readonly)
Errors associated with this job.
36 37 38 |
# File 'lib/animoto/resources/jobs/base.rb', line 36 def errors @errors end |
#state ⇒ String (readonly)
The state of this job.
32 33 34 |
# File 'lib/animoto/resources/jobs/base.rb', line 32 def state @state end |
#url ⇒ String (readonly)
The URL for this job.
28 29 30 |
# File 'lib/animoto/resources/jobs/base.rb', line 28 def url @url end |
Class Method Details
.endpoint(path = nil) ⇒ Object
18 19 20 |
# File 'lib/animoto/resources/jobs/base.rb', line 18 def self.endpoint path = nil super || infer_endpoint end |
.infer_content_type ⇒ String
14 15 16 |
# File 'lib/animoto/resources/jobs/base.rb', line 14 def self.infer_content_type super + '_job' end |
.infer_endpoint ⇒ Object
22 23 24 |
# File 'lib/animoto/resources/jobs/base.rb', line 22 def self.infer_endpoint "/jobs/#{name.split('::').last.underscore}" end |
.unpack_standard_envelope(body) ⇒ Hash{Symbol=>Object}
9 10 11 |
# File 'lib/animoto/resources/jobs/base.rb', line 9 def self.unpack_standard_envelope body super.merge(:state => unpack_payload(body)['state']) end |
Instance Method Details
#completed? ⇒ Boolean
Returns true if the state of this job is ‘completed’.
48 49 50 |
# File 'lib/animoto/resources/jobs/base.rb', line 48 def completed? @state == 'completed' end |
#failed? ⇒ Boolean
Returns true if the state of this job is ‘failed’.
41 42 43 |
# File 'lib/animoto/resources/jobs/base.rb', line 41 def failed? @state == 'failed' end |
#instantiate(attributes = {}) ⇒ Jobs::Base
61 62 63 64 |
# File 'lib/animoto/resources/jobs/base.rb', line 61 def instantiate attributes = {} @state = attributes[:state] super end |
#pending? ⇒ Boolean
Returns true if the job is neither failed or completed.
55 56 57 |
# File 'lib/animoto/resources/jobs/base.rb', line 55 def pending? !failed? && !completed? end |