Sha256: 8ec659f27097fc9053bc27d56bcbe18526839bd8018aa384c16a007cdd93af21

Contents?: true

Size: 766 Bytes

Versions: 9

Compression:

Stored size: 766 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

9 entries across 9 versions & 1 rubygems

Version Path
paddle-2.7.0 lib/paddle/models/product.rb
paddle-2.6.0 lib/paddle/models/product.rb
paddle-2.5.2 lib/paddle/models/product.rb
paddle-2.5.1 lib/paddle/models/product.rb
paddle-2.5.0 lib/paddle/models/product.rb
paddle-2.4.1 lib/paddle/models/product.rb
paddle-2.4.0 lib/paddle/models/product.rb
paddle-2.3.0 lib/paddle/models/product.rb
paddle-2.2.1 lib/paddle/models/product.rb