Sha256: 1b43c2b9c3607fa21e60d3673107c0ad868dbedcf2dcf59f8cd1c36e0acdbaeb

Contents?: true

Size: 797 Bytes

Versions: 9

Compression:

Stored size: 797 Bytes

Contents

module Paddle
  class Discount < Object
    class << self
      def list(**params)
        response = Client.get_request("discounts", params: params)
        Collection.from_response(response, type: Discount)
      end

      def create(amount:, description:, type:, **params)
        attrs = { amount: amount, description: description, type: type }
        response = Client.post_request("discounts", body: attrs.merge(params))
        Discount.new(response.body["data"])
      end

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

      def update(id:, **params)
        response = Client.patch_request("discounts/#{id}", body: params)
        Discount.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/discount.rb
paddle-2.6.0 lib/paddle/models/discount.rb
paddle-2.5.2 lib/paddle/models/discount.rb
paddle-2.5.1 lib/paddle/models/discount.rb
paddle-2.5.0 lib/paddle/models/discount.rb
paddle-2.4.1 lib/paddle/models/discount.rb
paddle-2.4.0 lib/paddle/models/discount.rb
paddle-2.3.0 lib/paddle/models/discount.rb
paddle-2.2.1 lib/paddle/models/discount.rb