Module: EightBall::Marshallers

Defined in:
lib/eight_ball/marshallers/json.rb

Overview

A JSON marshaller can convert back and forth between JSON and a list of Features The JSON produced will be pretty-printed, as it is assumed the output will be written to a file.

When converting from JSON, the top-level JSON element must be an array and its keys must use camel-case; this will be converted to snake-case by EightBall in order to adhere to both JSON and Ruby standards.

Below are some examples of valid JSON:

Examples:

A single Feature is enabled for accounts 1-5 as well as region Europe

[{
  "name": "Feature1",
  "enabledFor": [{
    "type": "range",
    "parameter": "accountId",
    "min": 1,
    "max": 5
  }, {
    "type": "list",
    "parameter": "regionName",
    "values": ["Europe"]
  }]
}]

A single Feature is disabled completely using the Always condition

[{
  "name": "Feature1",
  "disabledFor": [{
    "type": "always"
  }]
}]

Defined Under Namespace

Classes: Json