client = Prefab::Client.new(api_key: "ACCT|API_KEY")
@feature_flags = client.feature_flag_client
# Create a flag that is on for 10% of traffic, the entire beta group and user:1
@feature_flags.upsert(Prefab::FeatureFlag.new(feature: "MyFeature",
pct: 0.1,
whitelisted: ["betas", "user:1"]))
# Use Flags By Themselves
puts @feature_flags.feature_is_on? "MyFeature" # returns yes 10 pct of the time
# A single user should get the same result each time
# with 10% probability user1123 will return yes, and if they do they always will
puts @feature_flags.feature_is_on? "MyFeature", "user:1123"
# Utilize the whitelisted attributes to easily feature flag groups of people
puts @feature_flags.feature_is_on_for? "MyFeature",
"user:234",
attributes: ["betas"]}"