🚀 Getting Started
Walkthrough
10min
let's do a quick walkthrough of some kickplan basics using the sdk and the command line you'll need to install the sdk before starting this guide for this walkthrough, we're going to bee adding the ruby sdk to a rails app, but the process is similar for other languages and frameworks installation first choose one of the 👩💻 sdks docid 0w86hyr4k 8d lchhtxfr in the language of your choice in this walkthrough, we're going to be using the ruby sdk add the following to your gemfile and run bundle install gem "kickplan sdk", \ git => "git\@github com\ kickplan/sdk ruby git" create an initializer called kickplan rb and add the following require 'kickplan' kickplan configure do |config| config endpoint = env\['kickplan control plane'] config access token = env\['kickplan api key'] config adapter = \ http end see the sdk docs for a full list of configuration options set environment variables for your control plane endpoint url and your api key you will need to generate an api key from the settings/api keys screen in the kickplan app your control plane endpoint url will be provided by kickplan support during onboarding it looks something like this (note the /api at the end) https //example organization name fly dev/api in the rails console, let's check that everything is working enter kickplan config endpoint and confirm the listed endpoint is correct all good? great, let's have some fun create a feature now we're going to start modeling a very simple demo application from the command line lets say we are running a to do list app with two plans, basic and pro, which are differentiated by the number of lists you're allowed to create basic plans can have 3 lists, pro plans can have 10 lists let's create a feature called lists and model the different variants we want to support in the kickplan app enter lists as the key, lists as the name, and add a description if you like now enter the variants for this feature in this case, we want to define basic and pro variants that are set to 3 and 10, respectively if you wanted to allow the pro plan to create unlimited lists, you'd just set the value to a very high integer, say 99999 you can also define the default behaviors for when the feature is on and off click create and your feature should look something like the following validate the feature back in the rails console, let's retrieve details of our feature kickplan features resolve("lists") you should get a response that looks something like \#\<kickplan schemas resolution key="lists" value=3 error code=nil error message=nil metadata=nil reason=nil variant=nil> notice that our default value from the basic variant (ie, 3) is returned create plans features are good, but they are usually part of a plan, so let's create a couple of plans in the kickplan app, navigate to the plans section and create a basic and a pro plan under each plan, select feature access, and click add feature select the lists feature and for setting, select "always variant below" set the basic plan lists feature variant to basic (3 lists), and the pro plan lists feature variant to pro (10 lists) create an account in practice, features and plans only become valuable when you connect them to the accounts in your product let's create one from the console kickplan accounts create(key "23", name "tom hanks", account plans \[{ plan key "pro" }]) in the example above, we mapped the user id to the key (as a string), the user name to the name property, and set the account's plans to "pro" using the plan key retrieve account feature access to retrieve account level access to a feature, we can pass the account key as context and kickplan will respond with the corresponding feature values kickplan features resolve("lists", context { account key "23" })