Sha256: 89a435c503e122f2ea5f9038fa1459f5e864850d151a0767883e92bec18202fb

Contents?: true

Size: 522 Bytes

Versions: 7

Compression:

Stored size: 522 Bytes

Contents

# frozen_string_literal: true

require_relative '../api_resource'

module ErpIntegration
  module Fulfil
    module Resources
      class Product < ApiResource
        self.model_name = 'product.product'

        # Checks whether a certain product is a BOM.
        # @param sku [String] The product's SKU.
        # @return [Boolean] Whether it's a BOM or not.
        def bom?(sku)
          select(:boms).where(code: sku).first.boms.any?
        end
        alias billing_of_materials? bom?
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
erp_integration-0.5.5 lib/erp_integration/fulfil/resources/product.rb
erp_integration-0.5.4 lib/erp_integration/fulfil/resources/product.rb
erp_integration-0.5.3 lib/erp_integration/fulfil/resources/product.rb
erp_integration-0.5.2 lib/erp_integration/fulfil/resources/product.rb
erp_integration-0.5.1 lib/erp_integration/fulfil/resources/product.rb
erp_integration-0.5.0 lib/erp_integration/fulfil/resources/product.rb
erp_integration-0.4.0 lib/erp_integration/fulfil/resources/product.rb