Sha256: 8e20e5d240db85f795091a562c411d6e8c8e897f12aa97d081beac921670aa27

Contents?: true

Size: 895 Bytes

Versions: 10

Compression:

Stored size: 895 Bytes

Contents

module Paddle
  module Classic
    class ModifiersResource < Resource

      def list(**params)
        response = post_request("2.0/subscription/modifiers", body: params)
        Collection.from_response(response, type: Modifier)
      end

      def create(subscription_id:, modifier_amount:, **params)
        attrs = {subscription_id: subscription_id, modifier_amount: modifier_amount}
        create_response = post_request("2.0/subscription/modifiers/create", body: attrs.merge(params))

        response = post_request("2.0/subscription/modifiers", body: {subscription_id: subscription_id} )
        Collection.from_response(response, type: Modifier)
      end

      def delete(modifier_id:)
        attrs = {modifier_id: modifier_id}
        response = post_request("2.0/subscription/modifiers/delete", body: attrs)
        return true if response.success?
      end

    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
paddle-2.2.0 lib/paddle/classic/resources/modifiers.rb
paddle-2.1.4 lib/paddle/classic/resources/modifiers.rb
paddle-2.1.3 lib/paddle/classic/resources/modifiers.rb
paddle-2.1.2 lib/paddle/classic/resources/modifiers.rb
paddle-2.1.1 lib/paddle/classic/resources/modifiers.rb
paddle-2.1.0 lib/paddle/classic/resources/modifiers.rb
paddle-2.0.0 lib/paddle/classic/resources/modifiers.rb
paddle-1.1.2 lib/paddle/classic/resources/modifiers.rb
paddle-1.1.1 lib/paddle/classic/resources/modifiers.rb
paddle-1.1.0 lib/paddle/classic/resources/modifiers.rb