Example #1
0
    print('Id: %s' % node.id)
    print('Type: %s' % node.get_type())


def traverse_children(nodes):
    for node in nodes:
        node.print_details()
        traverse_children(node.children)


traverse_children(graph.root_node.children)

get_all_alpha_nodes(graph.root_node.children[0].children)

# ---------------------- Fetch data from DB
data = DataLayer().get_data(rules=[rule], filter={}, limit=5)

# ---------------------- Rule variables
print('\n\nPROCESSING VARIABLES...')
VariableProcessor().process_variables(data=data,
                                      variable_objs=rule['variables'])

# ---------------------- Initiate rule engine
print('\n\nPROCESSING RULES...')
engine = RuleEngine()
trigger = engine.run_efficiently(graphs=[graph],
                                 data=data,
                                 key=rule['key'],
                                 email='*****@*****.**')

# ---------------------- Expected Output
Example #2
0
from pyrete.core.data_layer import DataLayer

mapper = DataLayer()
mapper.get_all_collections()
demo_dict = {
    "subtotal_price":
    "51.00",
    "billing_address": {
        "province": "North Carolina",
        "city": "Franklinton"
    },
    "note_attributes": [{
        "name": "address-type",
        "value": "residential",
    }, {
        "name": "transit - time",
        "value": "1",
    }],
    "token":
    "384779c27a35e8fcc0c948ad87f0ac35"
}
mapper.get_collection_fields('orders')