Sha256: 78841f54c5417471ea622cbf64194fec727f4dca337ee92e59e6b1d2bd6bd03a
Contents?: true
Size: 856 Bytes
Versions: 1
Compression:
Stored size: 856 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pagarme-1.9.4 | lib/pagarme/subscription.rb |