Skip to content
Ember Addon to make Batch Requests to Rails Application
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
addon
app initial commit May 4, 2017
blueprints/ember-batch-request
config
tests initial commit May 4, 2017
vendor
.editorconfig
.ember-cli initial commit May 4, 2017
.eslintignore
.eslintrc.js
.gitignore
.jshintrc
.npmignore initial commit May 4, 2017
.travis.yml initial commit May 4, 2017
.watchmanconfig
LICENSE.md initial commit May 4, 2017
OSSMETADATA
README.md
ember-cli-build.js initial commit May 4, 2017
index.js
package.json fix error handling bug Aug 9, 2017
testem.js
yarn.lock initial commit May 4, 2017

README.md

ember-batch-request

NetflixOSS Lifecycle

Adapter add on for making Batch Requests in Ember Applications.

  • Customizable Adapter
  • Returns Success and Failure responses
  • Ability to skip store update in bulk scenario
  • Create or Update or Delete N records in 1 XHR call

Getting Started

As any other ember-cli add on, run:

ember install ember-batch-request

Setup

Since the Rails middleware depends on the url /api/v1/batch_sequential or /api/v1/batch_sequential, please add the following config to environment.js

ENV.apiNamespace = 'api/v1';
ENV.apiBatchUrl = 'batch_parallel'; (or batch_sequential)

Usage

BatchCreate

this.store.batchCreate(arrayOfObjects).then((response) => { });

BatchUpdate

this.store.batchUpdate(arrayOfObjects).then((response) => { });

BatchDelete

this.store.batchDelete(arrayOfObjects).then((response) => { });

How to skip Store Updates during Create or Update

Just pass the option { skipStoreUpdate: true } in batchCreate or batchUpdate

this.get('store').batchCreate(arrayOfObjects, { skipStoreUpdate: true })

Response

{
  completedResponses: [],
  errorResponses: []
}

ToDo

Update the store on creates

Contributing

If you would like to contribute, you can fork the project, edit, and make a pull request.

Tests

Please make sure that the test pass by running ember test. If you had a new functionality, add tests for it.

Note

Currently works with JSON API spec

You can’t perform that action at this time.