Sha256: 0ea24f1cfd69253e290b603e6b0e5017f77f5eb1ef9d915a169d90e2971fc734

Contents?: true

Size: 877 Bytes

Versions: 1

Compression:

Stored size: 877 Bytes

Contents

module Maestrano::Connector::Rails
  class Synchronization < ActiveRecord::Base
    self.table_name = "maestrano_connector_rails_synchronizations"

    #===================================
    # Associations
    #===================================
    belongs_to :organization

    validates :status, presence: true

    def is_running?
      self.status == 'RUNNING'
    end

    def is_error?
      self.status == 'ERROR'
    end

    def is_success?
      self.status == 'SUCCESS'
    end

    def self.create_running(organization)
      Synchronization.create(organization_id: organization.id, status: 'RUNNING')
    end

    def set_success
      self.update_attributes(status: 'SUCCESS')
    end

    def set_error(msg)
      self.update_attributes(status: 'ERROR', message: msg)
    end

    def set_partial
      self.update_attributes(partial: true)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
maestrano-connector-rails-0.2.0 app/models/maestrano/connector/rails/synchronization.rb