Sha256: 17af257d30aab8aed151320029ba926a25af1d7eac4f52444b32c90dea2f865c
Contents?: true
Size: 699 Bytes
Versions: 2
Compression:
Stored size: 699 Bytes
Contents
module Ecoportal module API class V1 class JobStatus attr_reader :id, :progress def initialize(id, complete, errored, progress) @id = id @complete = complete @errored = errored @progress = progress end def complete?(total = nil) return @complete if total.nil? progress >= total end def errored? @errored end def to_s msg = complete? ? "Completed" : "In progress" msg = "Errored" if errored? msg << " with #{progress} done." msg end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ecoportal-api-0.10.3 | lib/ecoportal/api/v1/job_status.rb |
ecoportal-api-0.10.2 | lib/ecoportal/api/v1/job_status.rb |