hoist / Hoist

A public repository for logging issues and documentation
MIT License
1 stars 1 forks source link

Hoist Connect: Hoist.json #5

Closed buildmaster closed 9 years ago

buildmaster commented 10 years ago

what should the hoist.json file look like?

buildmaster commented 10 years ago
{
    "connectors": {
        "chargify": {
            "token": "abkjs"
        },
        "xero": {
            "token": "eljrs"
        }
    },

    "modules": [

        {
            "name": "saveChargifyPaymentDetails",
            "src": "../scripts1.js",
            "defaultContext": "admin@hoi.io",
        }, {
            "name": "processBatchPayments",
            "src": "../scripts2.js",
            "overrideContext": "admin@hoi.io"
        }, {
            "name": "saveToXero",
            "src": "../scripts3.js",
            "defaultContext": "admin@hoi.io"
        }, {
            "name": "getFromXero",
            "src": "../scripts4.js",
            "defaultContext": "admin@hoi.io"
        }

    ],

    "on": {

        "chargify.payment.success": {
            "modules": ["saveChargifyPaymentDetails"]
        },

        "nightly.batch.start": {
            "modules": ["processBatchPayments"]
        },

        "new.invoice": {
            "modules": ["saveToXero"]
        },

        "get.invoices": {
            "modules": ["getFromXero"]
        }

    },

    "endpoints": {

        "/:product/getLatestInvoices": {
            "methods": ["GET"],
            "event": "get.invoices",
            "authenticated": true
        }

    },

    "schedules": {
        "0 0 * * *": {
            "events": [
                "nightly.batch.start"
            ]
        }
    }
}
abutel commented 10 years ago

Could/should the events be defined inside each module definition?

buildmaster commented 10 years ago

events can link to more than one module or to an endpoint or webhook so they're not synonymous