Sha256: a2ed03edfce8ed92b27b7daff8053e981a6d7eddfe6d31c57cc451322e55e698

Contents?: true

Size: 809 Bytes

Versions: 1

Compression:

Stored size: 809 Bytes

Contents

module Maestrano::Connector::Rails
  class Synchronization < ActiveRecord::Base
    #===================================
    # 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.0.1 app/models/maestrano/connector/rails/synchronization.rb