Sha256: 07b9fca9508e81d6b05b9b9f1b332a15ab58eba0a47ab7082cbc020b98b6770d

Contents?: true

Size: 658 Bytes

Versions: 4

Compression:

Stored size: 658 Bytes

Contents

require 'stripe'

module Colt
  class Subscription
    def self.create(email, stripe_token, plan_id, description='none')
      Stripe::Customer.create(email:       email, 
                              description: description, 
                              card:        stripe_token, 
                              plan:        plan_id)
    end
    
    def self.update(customer_id, plan_id)
      customer = Stripe::Customer.retrieve(customer_id)
      customer.update_subscription(plan: plan_id)
    end
    
    def self.cancel(customer_id)
      customer = Stripe::Customer.retrieve(customer_id) 
      customer.cancel_subscription
    end
  end
  
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
colt-0.4.3 lib/colt/subscription.rb
colt-0.4.2 lib/colt/subscription.rb
colt-0.4.1 lib/colt/subscription.rb
colt-0.3.0 lib/colt/subscription.rb