UNPKG

eva-sdk-js

Version:
98 lines (65 loc) 3.13 kB
# About the EVA JavaScript SDK [![Build Status](https://travis-ci.com/springtreesolutions/eva-sdk-js.svg?token=qQu37zC6ixyuy5nU7hvV&branch=master)](https://travis-ci.com/springtreesolutions/eva-sdk-js) > **DEPRECATION NOTICE: This SDK is deprecated. Please check out the [current EVA SDK](https://github.com/springtreesolutions/eva-sdk-repo)** The EVA SDK provides access to the functionality exposed by the EVA API using developer focused methods and classes. It is tightly coupled to the low-level shared definitions exposed by the EVA API. The SDK provides a higher level of abstraction for using the EVA API. ## Installing The SDK is available through both npm: ```bash npm install --save eva-sdk-js ``` and bower: ```bash bower install --save eva-sdk-js ``` ## Basic usage The SDK needs to be initialised once before it can be used. ```bash var EvaSDK = require( "eva-sdk-js" ); var applicationId = 1; var endPointURL = "https://eva.newblack.io"; var authenticationToken = "YOURTOKENHERE"; EvaSDK.init( authenticationToken, applicationId, endPointURL ); ``` Once initialised you can start using the classes exposed by the SDK to gain access to data in EVA. As an example the below code retrieves a product from the server. ```bash var product = new EvaSDK.Product( productId ); product.fetch() .then( function( response ) { // Product data is available in the response variable or // from the product.data property or product.getData() method // console.log( "Product data", response ); } ) .catch( function( error ) { console.error( "Product retrieval error", error ); } ); ``` You can check the documentation or unit tests for more examples ## Developing Dependencies are installed with `npm install` and `bower install` This SDK uses gulp for its development task. You can run `gulp` to get a list of available commands and a description of what the task does. Building the SDK bundle is done with `gulp build`. You may need to update the EVA shared definitions files at times. You can run `gulp typings` to automatically download and install them. During development you can let gulp watch for file changes and rebuild your bundle using `gulp watch`. ## Releasing Builds from master branch of the SDK are automatically published to NPM. Versioning is managed by semantic release. The master branch is locked for direct commits. Changed should be collected on develop and once a release is required a pull request on github needs to be made from develop to master. This pull request will be validated using TravisCI before it can be merged for the actual release build. ## Documentation The SDK is documented using typedoc. Once you can successfully build the SDK you can generate it using `gulp typedoc`. The documentation can be found in the docs/ folder. ## Testing You can run the unit tests with `gulp test` If you want to run a specific unit test you can specify you can do: ```bash gulp test --tests=test/products-spec.js ``` You can run the tests without building like so: ```bash gulp test --skip-build --tests=test/products-spec.js ```