Sha256: a45bc3ea8874305baf38aeaa4174c5970956191a005764d4e98d655a0904d705
Contents?: true
Size: 1.23 KB
Versions: 1
Compression:
Stored size: 1.23 KB
Contents
module Paysio class Customer < APIResource include Paysio::APIOperations::Create include Paysio::APIOperations::Delete include Paysio::APIOperations::Update include Paysio::APIOperations::List def add_invoice_item(params) InvoiceItem.create(params.merge(:customer => id), @api_key) end def invoices Invoice.all({ :customer => id }, @api_key) end def invoice_items InvoiceItem.all({ :customer => id }, @api_key) end def charges Charge.all({ :customer => id }, @api_key) end def cancel_subscription(params={}) response, api_key = Paysio.request(:delete, subscription_url, @api_key, params) refresh_from({ :subscription => response }, api_key, true) subscription end def update_subscription(params) response, api_key = Paysio.request(:post, subscription_url, @api_key, params) refresh_from({ :subscription => response }, api_key, true) subscription end def delete_discount Paysio.request(:delete, discount_url, @api_key) refresh_from({ :discount => nil }, api_key, true) end private def discount_url url + '/discount' end def subscription_url url + '/subscription' end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
paysio-1.0.0 | lib/paysio/customer.rb |