Sha256: 2445ce14a4405e2888663264e200c60e3a96e1d52da2a1947c6bca52f466ba3d
Contents?: true
Size: 1.83 KB
Versions: 1
Compression:
Stored size: 1.83 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") Subscription.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 end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
paddle-2.1.0 | lib/paddle/models/subscription.rb |