Class: Retab::Job
- Inherits:
-
Types::BaseModel
- Object
- Types::BaseModel
- Retab::Job
- Defined in:
- lib/retab/jobs/job.rb
Constant Summary collapse
- HASH_ATTRS =
{ id: :id, object: :object, status: :status, endpoint: :endpoint, error: :error, warnings: :warnings, created_at: :created_at, started_at: :started_at, completed_at: :completed_at, expires_at: :expires_at, metadata: :metadata, cancelled: :cancelled, attempt_count: :attempt_count, last_attempt_at: :last_attempt_at, last_failure_code: :last_failure_code, request: :request, response: :response }.freeze
Instance Attribute Summary collapse
-
#attempt_count ⇒ Object
Returns the value of attribute attempt_count.
-
#cancelled ⇒ Object
Returns the value of attribute cancelled.
-
#completed_at ⇒ Object
Returns the value of attribute completed_at.
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#endpoint ⇒ Object
Returns the value of attribute endpoint.
-
#error ⇒ Object
Returns the value of attribute error.
-
#expires_at ⇒ Object
Returns the value of attribute expires_at.
-
#id ⇒ Object
Returns the value of attribute id.
-
#last_attempt_at ⇒ Object
Returns the value of attribute last_attempt_at.
-
#last_failure_code ⇒ Object
Returns the value of attribute last_failure_code.
-
#metadata ⇒ Object
Returns the value of attribute metadata.
-
#object ⇒ Object
Returns the value of attribute object.
-
#request ⇒ Object
Returns the value of attribute request.
-
#response ⇒ Object
Returns the value of attribute response.
-
#started_at ⇒ Object
Returns the value of attribute started_at.
-
#status ⇒ Object
Returns the value of attribute status.
-
#warnings ⇒ Object
Returns the value of attribute warnings.
Attributes inherited from Types::BaseModel
Instance Method Summary collapse
-
#initialize(json) ⇒ Job
constructor
A new instance of Job.
Methods inherited from Types::BaseModel
#inspect, normalize, #to_h, #to_json
Constructor Details
#initialize(json) ⇒ Job
Returns a new instance of Job.
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/retab/jobs/job.rb', line 47 def initialize(json) hash = self.class.normalize(json) @id = hash[:id] @object = hash[:object] @status = hash[:status] @endpoint = hash[:endpoint] @error = hash[:error] ? Retab::JobError.new(hash[:error]) : nil @warnings = (hash[:warnings] || []).map { |item| item ? Retab::JobWarning.new(item) : nil } @created_at = hash[:created_at] @started_at = hash[:started_at] @completed_at = hash[:completed_at] @expires_at = hash[:expires_at] @metadata = hash[:metadata] || {} @cancelled = hash[:cancelled] @attempt_count = hash[:attempt_count] @last_attempt_at = hash[:last_attempt_at] @last_failure_code = hash[:last_failure_code] @request = hash[:request] || {} @response = hash[:response] ? Retab::JobResponse.new(hash[:response]) : nil end |
Instance Attribute Details
#attempt_count ⇒ Object
Returns the value of attribute attempt_count.
28 29 30 |
# File 'lib/retab/jobs/job.rb', line 28 def attempt_count @attempt_count end |
#cancelled ⇒ Object
Returns the value of attribute cancelled.
28 29 30 |
# File 'lib/retab/jobs/job.rb', line 28 def cancelled @cancelled end |
#completed_at ⇒ Object
Returns the value of attribute completed_at.
28 29 30 |
# File 'lib/retab/jobs/job.rb', line 28 def completed_at @completed_at end |
#created_at ⇒ Object
Returns the value of attribute created_at.
28 29 30 |
# File 'lib/retab/jobs/job.rb', line 28 def created_at @created_at end |
#endpoint ⇒ Object
Returns the value of attribute endpoint.
28 29 30 |
# File 'lib/retab/jobs/job.rb', line 28 def endpoint @endpoint end |
#error ⇒ Object
Returns the value of attribute error.
28 29 30 |
# File 'lib/retab/jobs/job.rb', line 28 def error @error end |
#expires_at ⇒ Object
Returns the value of attribute expires_at.
28 29 30 |
# File 'lib/retab/jobs/job.rb', line 28 def expires_at @expires_at end |
#id ⇒ Object
Returns the value of attribute id.
28 29 30 |
# File 'lib/retab/jobs/job.rb', line 28 def id @id end |
#last_attempt_at ⇒ Object
Returns the value of attribute last_attempt_at.
28 29 30 |
# File 'lib/retab/jobs/job.rb', line 28 def last_attempt_at @last_attempt_at end |
#last_failure_code ⇒ Object
Returns the value of attribute last_failure_code.
28 29 30 |
# File 'lib/retab/jobs/job.rb', line 28 def last_failure_code @last_failure_code end |
#metadata ⇒ Object
Returns the value of attribute metadata.
28 29 30 |
# File 'lib/retab/jobs/job.rb', line 28 def @metadata end |
#object ⇒ Object
Returns the value of attribute object.
28 29 30 |
# File 'lib/retab/jobs/job.rb', line 28 def object @object end |
#request ⇒ Object
Returns the value of attribute request.
28 29 30 |
# File 'lib/retab/jobs/job.rb', line 28 def request @request end |
#response ⇒ Object
Returns the value of attribute response.
28 29 30 |
# File 'lib/retab/jobs/job.rb', line 28 def response @response end |
#started_at ⇒ Object
Returns the value of attribute started_at.
28 29 30 |
# File 'lib/retab/jobs/job.rb', line 28 def started_at @started_at end |
#status ⇒ Object
Returns the value of attribute status.
28 29 30 |
# File 'lib/retab/jobs/job.rb', line 28 def status @status end |
#warnings ⇒ Object
Returns the value of attribute warnings.
28 29 30 |
# File 'lib/retab/jobs/job.rb', line 28 def warnings @warnings end |