Sha256: 8ab05b1bda75bd8b85f2f7605265d3525806ca3d5bf3748d890fae8e3cfe3d3f

Contents?: true

Size: 586 Bytes

Versions: 1

Compression:

Stored size: 586 Bytes

Contents

module G5Updatable
  class IntegrationSetting < ActiveRecord::Base
    include G5Updatable::FirstClassProperties
    include G5Updatable::UrnAsParameter

    validates :uid, presence: true
    validates :location_uid, presence: true

    INVENTORY = 'inventory'
    LEAD      = 'lead'

    scope :by_vendor_action, -> (vendor_action) { where(vendor_action: vendor_action) }
    scope :by_inventory, -> { by_vendor_action(INVENTORY) }
    scope :by_lead, -> { by_vendor_action(LEAD) }

    def location
      @client ||= G5Updatable::Location.find_by_uid(location_uid)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
g5_updatable-0.3.1 app/models/g5_updatable/integration_setting.rb