Authorized API - myna/ruby-eventmachine-client GitHub Wiki

Authorized API

If you need to do more complex operations than the Unauthorized API supports, you need to use this API.

Myna.authorize(email, password)

Returns an AuthorizedMyna given your String email and password.

Example

myna = Myna.authorize('[email protected]', 'themostsecretpassword')

Authorized Myna

An AuthorizedMyna represents an authorized connection to the Myna API server.

AuthorizedMyna#create(name)

Given a String name, create an experiment with that name. Returns a future of an AuthorizedExperiment (see below).

Example

experiment = myna.create('My new experiment').get

AuthorizedMyna#experiment(uuid)

Given a String UUID returns an AuthorizedExperiment representing that experiment.

Example

experiment = myna.experiment('45923780-80ed-47c6-aa46-15e2ae7a0e8c')

Authorized Experiment

An AuthorizedExperiment supports the suggest and reward methods on Experiment in the Unauthorized API, and has additional methods to support operations that require authorization.

AuthorizedExperiment#uuid

Returns the UUID, a String, of this AuthorizedExperiment

experiment = myna.experiment('45923780-80ed-47c6-aa46-15e2ae7a0e8c')
puts "UUID is #{experiment.uuid}" # The UUID is 45923780-80ed-47c6-aa46-15e2ae7a0e8c

AuthorizedExperiment#info

Get information about this experiment, represented by an Experiment Response. Returns a future of said Experiment response.

experiment = myna.experiment('45923780-80ed-47c6-aa46-15e2ae7a0e8c')
info = experiment.info.get

AuthorizedExperiment#create_variant(name)

Given a String name for a variant, creates that variant on this experiment. Returns a future of the Ok Response.

experiment = myna.experiment('45923780-80ed-47c6-aa46-15e2ae7a0e8c')
ok = experiment.create_variant('A new variant').get

AuthorizedExperiment#delete_variant(name)

Given a String name for a variant, deletes that variant on this experiment. Returns a future of the Ok Response.

experiment = myna.experiment('45923780-80ed-47c6-aa46-15e2ae7a0e8c')
ok = experiment.delete_variant('A new variant').get # Bye bye

AuthorizedExperiment#reset

Resets the counters of all the variants in this experiment. Returns a future of the Ok Response.

experiment = myna.experiment('45923780-80ed-47c6-aa46-15e2ae7a0e8c')
ok = experiment.reset.get # Forgot all views and conversions

AuthorizedExperiment#delete

Deletes this experiment. Returns a future of the Ok Response.

experiment = myna.experiment('45923780-80ed-47c6-aa46-15e2ae7a0e8c')
ok = experiment.delete.get # Bye bye experiment