Sha256: 4720dab9c554f40a8283782e2d140d057ae52987b09c50baafbbe66b52dc109c

Contents?: true

Size: 519 Bytes

Versions: 34

Compression:

Stored size: 519 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).find_by!(code: sku).boms.any?
        end
        alias billing_of_materials? bom?
      end
    end
  end
end

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
erp_integration-0.19.0 lib/erp_integration/fulfil/resources/product.rb
erp_integration-0.18.0 lib/erp_integration/fulfil/resources/product.rb
erp_integration-0.17.0 lib/erp_integration/fulfil/resources/product.rb
erp_integration-0.16.0 lib/erp_integration/fulfil/resources/product.rb
erp_integration-0.15.0 lib/erp_integration/fulfil/resources/product.rb
erp_integration-0.14.0 lib/erp_integration/fulfil/resources/product.rb
erp_integration-0.13.0 lib/erp_integration/fulfil/resources/product.rb
erp_integration-0.12.0 lib/erp_integration/fulfil/resources/product.rb
erp_integration-0.11.0 lib/erp_integration/fulfil/resources/product.rb
erp_integration-0.10.0 lib/erp_integration/fulfil/resources/product.rb
erp_integration-0.9.0 lib/erp_integration/fulfil/resources/product.rb
erp_integration-0.8.0 lib/erp_integration/fulfil/resources/product.rb
erp_integration-0.7.0 lib/erp_integration/fulfil/resources/product.rb
erp_integration-0.6.0 lib/erp_integration/fulfil/resources/product.rb