Sha256: b62657653708f9a4cfda968d5048b88669911677f05a04ba6b9ce564d0a94d52
Contents?: true
Size: 1.92 KB
Versions: 6
Compression:
Stored size: 1.92 KB
Contents
module Seam class Effort attr_accessor :completed_steps attr_accessor :created_at attr_accessor :complete attr_accessor :id attr_accessor :next_execute_at attr_accessor :next_step attr_accessor :flow attr_accessor :data attr_accessor :history class << self def find effort_id Seam::Persistence.find_by_effort_id effort_id end def find_all_by_step step Seam::Persistence.find_all_pending_executions_by_step step end def parse document effort = Effort.new effort.id = document['id'] effort.created_at = Time.parse(document['created_at'].to_s) effort.next_execute_at = document['next_execute_at'] effort.next_step = document['next_step'] effort.flow = HashWithIndifferentAccess.new document['flow'] effort.data = HashWithIndifferentAccess.new document['data'] effort.history = document['history'].map { |x| HashWithIndifferentAccess.new x } effort.completed_steps = document['completed_steps'] effort.complete = document['complete'] effort end end def initialize @completed_steps = [] @history = [] @complete = false end def save existing_record = Seam::Effort.find self.id if existing_record Seam::Persistence.save self else Seam::Persistence.create self end end def complete? complete end def to_hash { id: self.id, created_at: self.created_at, completed_steps: self.completed_steps, next_execute_at: self.next_execute_at, next_step: self.next_step, flow: self.flow, data: self.data, history: self.history, complete: self.complete, } end end end
Version data entries
6 entries across 6 versions & 1 rubygems
Version | Path |
---|---|
seam-0.0.6 | lib/seam/effort.rb |
seam-0.0.5 | lib/seam/effort.rb |
seam-0.0.4 | lib/seam/effort.rb |
seam-0.0.3 | lib/seam/effort.rb |
seam-0.0.2 | lib/seam/effort.rb |
seam-0.0.1 | lib/seam/effort.rb |