Project

submane

0.0
The project is in a healthy, maintained state
Subscription management gem for rails.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Runtime

>= 7.1.3.4
 Project Readme

Submane

A rails gem for subscription management.

Installation

Add this line to your application's Gemfile:

gem "submane"

And then execute:

$ bundle

Or install it with bundle install:

$ bundle install submane

We then run the following command to add migrations and config yml file

$ bin/rails generate submane:install

Finally, we can add the class that subscriptions will be attached to. Assuming "Account" class will hold the subscriptions, then we set is as the following string in config/submane.yml

account_class: Account

Usage

With the "Account" instance, let assume it is "account"

account = Account.new(...)

Active plan

Get the active plan

account.active_plan

Check if account has active plan

account.has_active_plan?

Create Plans

  Submane.create_plan(name: "", price: "", visual_order: 1)

Subscription

Get all subscriptions

account.subscriptions

Get all active Subscriptions for a plan

Submane.plan_active_subscriptions({plan_id})

Get active subscription

account.active_subscription

Contributing

Contribution directions go here.

License

The gem is available as open source under the terms of the MIT License.