Sha256: c5bca658145c936bcab993f9c4c8825876b76ef2f0e27d7dab89c67ef0d8d2c8
Contents?: true
Size: 1.98 KB
Versions: 9
Compression:
Stored size: 1.98 KB
Contents
module Paddle class Subscription < Object class << self def list(**params) response = Client.get_request("subscriptions", params: params) Collection.from_response(response, type: Subscription) end def retrieve(id:, extra: nil) params = extra ? { include: extra } : {} response = Client.get_request("subscriptions/#{id}", params: params) Subscription.new(response.body["data"]) end def get_transaction(id:) response = Client.get_request("subscriptions/#{id}/update-payment-method-transaction") Transaction.new(response.body["data"]) end def preview(id:, **params) response = Client.patch_request("subscriptions/#{id}/preview", body: params) Subscription.new(response.body["data"]) end def update(id:, **params) response = Client.patch_request("subscriptions/#{id}", body: params) Subscription.new(response.body["data"]) end def charge(id:, items:, effective_from:, **params) attrs = { items: items, effective_from: effective_from } response = Client.post_request("subscriptions/#{id}/charge", body: attrs.merge(params)) Subscription.new(response.body["data"]) end def pause(id:, **params) response = Client.post_request("subscriptions/#{id}/pause", body: params) Subscription.new(response.body["data"]) end def resume(id:, effective_from:, **params) attrs = { effective_from: effective_from } response = Client.post_request("subscriptions/#{id}/resume", body: attrs.merge(params)) Subscription.new(response.body["data"]) end def cancel(id:, **params) response = Client.post_request("subscriptions/#{id}/cancel", body: params) Subscription.new(response.body["data"]) end def activate(id:) response = Client.post_request("subscriptions/#{id}/activate") Subscription.new(response.body["data"]) end end end end
Version data entries
9 entries across 9 versions & 1 rubygems