Sha256: 1b78b3728301e9c6e558d4976f946ed2ac4a027bb18f7ee04915304dfeb34a37

Contents?: true

Size: 1.52 KB

Versions: 5

Compression:

Stored size: 1.52 KB

Contents

module Moysklad::Entities
  class Product < Entity
    include AttributesConverter
    attribute :accountId,         String
    attribute :owner,             Owner
    attribute :group,             Group
    attribute :description,       String
    # attribute :shared,            Shared
    attribute :vat, Float
    attribute :effectiveVat, Float
    attribute :pathName,          String
    attribute :productFolder,     Productfolder

    attribute :uom,               Uom

    attribute :minPrice,          Float
    attribute :buyPrice,          Currency
    attribute :salePrices,        Array[Price]

    attribute :images,            Images # MetaArray

    attribute :article,           String
    attribute :weighed,           Boolean
    attribute :attrs,             Array[Attribute]
    attribute :weight,            Float
    attribute :volume,            Float
    attribute :barcodes,          Array[String]

    attribute :isSerialTrackable, Boolean

    attribute :modificationsCount, Integer


    # Когда загружаем через ассортименты эти поля устанавливаются
    attribute :stock, Float
    attribute :reserve, Float
    attribute :inTransit, Float
    attribute :quantity, Float

    # preferences

    def features universe
      cache :features, universe do
        universe.features.where goodUuid: uuid
      end
    end

    def product_images(universe)
      Moysklad::Resources::ProductImages.new(client: universe.client, list_path: images.meta.href).list
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
moysklad-0.5 lib/moysklad/entities/product.rb
moysklad-0.4.10 lib/moysklad/entities/product.rb
moysklad-0.4.9 lib/moysklad/entities/product.rb
moysklad-0.4.8 lib/moysklad/entities/product.rb
moysklad-0.4.7 lib/moysklad/entities/product.rb