Sha256: 58c91252d4267a5917a89782ba5b7f0768a0ff91e0f71acc5dcac2001aded0ce

Contents?: true

Size: 799 Bytes

Versions: 10

Compression:

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

10 entries across 10 versions & 1 rubygems

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