Sha256: c67de2bdc4d7420934c22235887e6d8c47a4b308e0f89ed30e8b7c61d57640df
Contents?: true
Size: 852 Bytes
Versions: 9
Compression:
Stored size: 852 Bytes
Contents
# encoding: utf-8 require File.join(File.dirname(__FILE__), '..', 'pagarme') module PagarMe class Subscription < TransactionCommon def create if self.plan self.plan_id = plan.id end self.plan = nil super end def save if self.plan self.plan_id = plan.id end self.plan = nil super end def cancel request = PagarMe::Request.new(self.url + '/cancel', 'POST') response = request.run update(response) end def charge(amount, installments = 1) request = PagarMe::Request.new(self.url + '/transactions', 'POST') request.parameters = { :amount => amount, :installments => installments } response = request.run request = PagarMe::Request.new(self.url, 'GET') update(request.run) end end end
Version data entries
9 entries across 9 versions & 1 rubygems