Sha256: aabe9270518006e25651d41648f7293e0d44f1478cfe474600db81ed7b6bb7c0
Contents?: true
Size: 1.26 KB
Versions: 4
Compression:
Stored size: 1.26 KB
Contents
module Paddle class Transaction < Object class << self def list(**params) response = Client.get_request("transactions", params: params) Collection.from_response(response, type: Transaction) end def create(items:, **params) attrs = { items: items } response = Client.post_request("transactions", body: attrs.merge(params)) Transaction.new(response.body["data"]) end def retrieve(id:, extra: nil) params = extra ? { include: extra } : {} response = Client.get_request("transactions/#{id}", params: params) Transaction.new(response.body["data"]) end def update(id:, **params) response = Client.patch_request("transactions/#{id}", body: params) Transaction.new(response.body["data"]) end def invoice(id:, disposition: "attachment") response = Client.get_request("transactions/#{id}/invoice?disposition=#{disposition}") if response.success? response.body["data"]["url"] end end def preview(items:, **params) attrs = { items: items } response = Client.post_request("transactions/preview", body: attrs.merge(params)) Transaction.new(response.body["data"]) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
paddle-2.7.0 | lib/paddle/models/transaction.rb |
paddle-2.6.0 | lib/paddle/models/transaction.rb |
paddle-2.5.2 | lib/paddle/models/transaction.rb |
paddle-2.5.1 | lib/paddle/models/transaction.rb |