0.0.24 • Published 7 years ago

ember-batch-request v0.0.24

Weekly downloads
1,001
License
Apache
Repository
github
Last release
7 years ago

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

0.0.24

7 years ago

0.0.23

7 years ago

0.0.22

7 years ago

0.0.21

7 years ago

0.0.20

7 years ago

0.0.19

7 years ago

0.0.18

7 years ago

0.0.17

7 years ago

0.0.16

7 years ago