Sha256: 5f036b00fa10e9abcb364ec7c73a814cfaa2bb725228e6f58efcb8056245750b

Contents?: true

Size: 570 Bytes

Versions: 9

Compression:

Stored size: 570 Bytes

Contents

module StripeLocal
	class PlanSync
		require 'stripe'

		class<<self
			def then_sync %i{from_hash}
				Stripe::Plan.create from_hash
			end

			def then_destroy id
				Stripe::Plan.retrieve( id ).delete
			end
		end

		def after_create plan
			attributes = {
				id: plan.id,
				name: plan.name,
				amount: plan.amount,
				currency: 'usd',
				interval: plan.interval,
				interval_count: plan.interval_count,
				trial_period_days: 0
			}
			PlanSync.delay.then_sync attributes
	  end

		def after_destroy plan
			PlanSync.delay.then_destroy plan.id
		end

	end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
stripe_local-0.2.3 app/callbacks/stripe_local/plan_sync.rb
stripe_local-0.2.2 app/callbacks/stripe_local/plan_sync.rb
stripe_local-0.2.1 app/callbacks/stripe_local/plan_sync.rb
stripe_local-0.2.0 app/callbacks/stripe_local/plan_sync.rb
stripe_local-0.1.3 app/callbacks/stripe_local/plan_sync.rb
stripe_local-0.1.2 app/callbacks/stripe_local/plan_sync.rb
stripe_local-0.1.1 app/callbacks/stripe_local/plan_sync.rb
stripe_local-0.1.0 app/callbacks/stripe_local/plan_sync.rb
stripe_local-0.0.2 app/callbacks/stripe_local/plan_sync.rb