-
Notifications
You must be signed in to change notification settings - Fork 3
Unauthorized API
Noel Welsh edited this page May 18, 2012
·
3 revisions
If you just want to make suggestions and rewards the following unauthorized API will do.
Constructs an Experiment given a string UUID.
Example
expt = Myna.experiment('45923780-80ed-47c6-aa46-15e2ae7a0e8c')Returns a Future of a Suggestion. A Suggestion has two attributes:
-
choice, a string representing the choice Myna suggests -
token, a string representing the token you must pass toreward
Example
expt = Myna.experiment('45923780-80ed-47c6-aa46-15e2ae7a0e8c')
future = expt.suggest.get
suggestion = future.get
puts "Now do something with the suggestion #{suggestion.choice}"Rewards a suggestion. Token is a string, and the optional amount is a number between 0 and 1. Returned is a future of the Ok singleton.
Example
expt = Myna.experiment('45923780-80ed-47c6-aa46-15e2ae7a0e8c')
suggestion = expt.suggest.get
puts("Choice is #{suggestion.choice}")
expt.reward(suggestion.token, 1.0)