Sha256: adaf1ac7419ec3a52f2e0bea9264d77dae7b58f465ab232174b58baf11c6e79a

Contents?: true

Size: 506 Bytes

Versions: 5

Compression:

Stored size: 506 Bytes

Contents

module MeducationSDK
  class EcommerceProduct < Resource
    self.path = "/ecommerce_products"

    def item
      @item ||= sdk_class_for(item_type).find(item_id)
    end

    def collection
      item.is_a?(Collection) ? item : (raise MeducationSDKError.new("Item is not a collection. It is a #{item.class.name}"))
    end

  end

  class EcommerceProductMock < EcommerceProduct
    extend Loquor::ResourceMock

    self.attributes = {
      id: 1,
      item_type: 89,
      item_id: 90
    }
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
meducation_sdk-2.2.2 lib/meducation_sdk/resources/ecommerce_product.rb
meducation_sdk-2.2.1 lib/meducation_sdk/resources/ecommerce_product.rb
meducation_sdk-2.2.0 lib/meducation_sdk/resources/ecommerce_product.rb
meducation_sdk-2.1.4 lib/meducation_sdk/resources/ecommerce_product.rb
meducation_sdk-2.1.3 lib/meducation_sdk/resources/ecommerce_product.rb