Sha256: d1a7674642faec9926c23db06197fb8625d444df8af1f78ee55e0a2249db0dd1

Contents?: true

Size: 622 Bytes

Versions: 2

Compression:

Stored size: 622 Bytes

Contents

require "pwinty/api_models/product_dimensions"
require "pwinty/api_models/product_variant"

module Pwinty
  class Product < Pwinty::Base
    """https://www.prodigi.com/print-api/docs/reference/#product-details"""
    attribute :sku, Types::String
    attribute :description, Types::String
    attribute :productDimensions, Pwinty::ProductDimensions
    attribute :attributes, Types::Hash
    attribute :printAreas, Types::Hash
    attribute :variants, Types::Array.of(Pwinty::ProductVariant)

    def self.find(sku)
      response = Pwinty.conn.get("products/#{sku}")
      new(response.body['product'])
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pwinty-4.0.1 lib/pwinty/api_models/product.rb
pwinty-4.0.0 lib/pwinty/api_models/product.rb