Sha256: c628e5f1ea04459b3ffad8a8e08978764aaaa2328655bb767dd6dcb5e704e7a3

Contents?: true

Size: 756 Bytes

Versions: 88

Compression:

Stored size: 756 Bytes

Contents

module Xsys
  module Model
    class BackgroundJob
      def self.attr_list
        [:code, :shop_code, :label, :arguments, :status, :processed_items,
         :total_items, :observations, :started_at, :ended_at, :events]
      end

      attr_reader *attr_list

      def initialize(attributes={})
        attributes.each do |k, v|
          if k.to_s == 'events'
            @events = v.map { |x| JobEvent.new(x) }
          elsif k.to_s == 'started_at'
            @started_at = Time.parse(v)
          elsif k.to_s == 'ended_at'
            @ended_at = Time.parse(v) unless v.nil?
          else
            self.send("#{k}=", v) if self.respond_to?(k)
          end
        end
      end

      private

      attr_writer *attr_list
    end
  end
end

Version data entries

88 entries across 88 versions & 1 rubygems

Version Path
xsys-0.8.0 lib/xsys/model/background_job.rb
xsys-0.7.0 lib/xsys/model/background_job.rb
xsys-0.6.5 lib/xsys/model/background_job.rb
xsys-0.6.4 lib/xsys/model/background_job.rb
xsys-0.6.3 lib/xsys/model/background_job.rb
xsys-0.6.2 lib/xsys/model/background_job.rb
xsys-0.6.1 lib/xsys/model/background_job.rb
xsys-0.6.0 lib/xsys/model/background_job.rb
xsys-0.5.2 lib/xsys/model/background_job.rb
xsys-0.5.1 lib/xsys/model/background_job.rb
xsys-0.5.0 lib/xsys/model/background_job.rb
xsys-0.4.1 lib/xsys/model/background_job.rb
xsys-0.4.0 lib/xsys/model/background_job.rb
xsys-0.3.2 lib/xsys/model/background_job.rb
xsys-0.3.1 lib/xsys/model/background_job.rb
xsys-0.3.0 lib/xsys/model/background_job.rb
xsys-0.2.15 lib/xsys/model/background_job.rb
xsys-0.2.14 lib/xsys/model/background_job.rb
xsys-0.2.13 lib/xsys/model/background_job.rb
xsys-0.2.12 lib/xsys/model/background_job.rb