GithubHelp home page GithubHelp logo

timotheeville / ember-batch-request Goto Github PK

View Code? Open in Web Editor NEW

This project forked from netflix/ember-batch-request

0.0 1.0 0.0 80 KB

Ember Addon to make Batch Requests to Rails Application

License: Apache License 2.0

JavaScript 90.18% HTML 9.82%

ember-batch-request's Introduction

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

ember-batch-request's People

Contributors

shishirmk avatar jamesmenera avatar sriniwasgr avatar aspyker avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.