1.0.0 • Published 2 years ago

ring-websites-sdk v1.0.0

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

Ring Websites SDK

Ring Websites SDK will help You to use Ring Websites API: https://api.ringpublishing.com/websites/v2

All you need is your Websites Space UUID and access/secret keys.

Requirements

Make sure you have NodeJS installed and running in version 14 or above.

Installation

When you have your node running, install our SDK by running the command:

    $ npm install -g ring-websites-sdk

Usage

Look how easy is to use Ring Website API using SDK:

    let RingWebsitesSDK = require('ring-websites-sdk');
    
    let space = process.env.SPACE;
    let access = process.env.ACCESS;
    let secret = process.env.SECRET;
    
    console.log("ARGUMENTS:", space, access, secret);
    
    let rwSdk = new RingWebsitesSDK(space, access, secret);
    
    rwSdk.call({query: `{ name }`}).then(function(data) {
        console.log("DATA", data);
    }).catch(function(error) {
        console.log("ERR", error);
    });

Reference

    class RingWebsitesSDK

        constructor:
            spaceUuid (UUIDv4 string) - Websites Space UUID
            accessKey (UUIDv4 string) - Access Key
            secretKey (UUIDv4 string) - Secret Key
            options (object):
                - timeout (number, default 4000) - Response timeout 
    
        methods:
            call (request Object) - query/mutation object:
                {
                    query/mutation (string/ required): GQL string
                    operationName (string): operation name
                    variables (key/value Object): query variables
                }