Sha256: a0dad090fd4b7f5c87534995760db1635c4f74a07787ba7f291087ee87a21af7

Contents?: true

Size: 891 Bytes

Versions: 9

Compression:

Stored size: 891 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)
        true if response.success?
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
paddle-2.7.0 lib/paddle/classic/resources/modifiers.rb
paddle-2.6.0 lib/paddle/classic/resources/modifiers.rb
paddle-2.5.2 lib/paddle/classic/resources/modifiers.rb
paddle-2.5.1 lib/paddle/classic/resources/modifiers.rb
paddle-2.5.0 lib/paddle/classic/resources/modifiers.rb
paddle-2.4.1 lib/paddle/classic/resources/modifiers.rb
paddle-2.4.0 lib/paddle/classic/resources/modifiers.rb
paddle-2.3.0 lib/paddle/classic/resources/modifiers.rb
paddle-2.2.1 lib/paddle/classic/resources/modifiers.rb