Sha256: 2a6a54381913b4f618f0de4924f31bfeb63af0e9a0afaa071b69a83274a6060d

Contents?: true

Size: 768 Bytes

Versions: 10

Compression:

Stored size: 768 Bytes

Contents

module Paddle
  class Product < Object

    class << self

      def list(**params)
        response = Client.get_request("products", params: params)
        Collection.from_response(response, type: Product)
      end

      def create(name:, tax_category:, **params)
        attrs = {name: name, tax_category: tax_category}
        response = Client.post_request("products", body: attrs.merge(params))
        Product.new(response.body["data"])
      end

      def retrieve(id:)
        response = Client.get_request("products/#{id}")
        Product.new(response.body["data"])
      end

      def update(id:, **params)
        response = Client.patch_request("products/#{id}", body: params)
        Product.new(response.body["data"])
      end

    end

  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
paddle-2.2.0 lib/paddle/models/product.rb
paddle-2.1.4 lib/paddle/models/product.rb
paddle-2.1.3 lib/paddle/models/product.rb
paddle-2.1.2 lib/paddle/models/product.rb
paddle-2.1.1 lib/paddle/models/product.rb
paddle-2.1.0 lib/paddle/models/product.rb
paddle-2.0.0 lib/paddle/models/product.rb
paddle-1.1.2 lib/paddle/models/product.rb
paddle-1.1.1 lib/paddle/models/product.rb
paddle-1.1.0 lib/paddle/models/product.rb