Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add multi item push to fix issue #39 #41

Merged
merged 4 commits into from
Jun 26, 2017

Conversation

jordanwalsh23
Copy link
Contributor

Add support for multi item push using the following code:

       var sampleItem = {
            Code: 'Item-' + Math.random(),
            Name: 'Fully Tracked Item',
            Description: '2014 Merino Sweater',
            PurchaseDescription: '2014 Merino Sweater',
            PurchaseDetails: {
                UnitPrice: 149.00,
                AccountCode: salesAccount
            },
            SalesDetails: {
                UnitPrice: 299.00,
                AccountCode: salesAccount
            }
        };            
            
            var items = [];

            for (var i = 0; i < 10; i++) {
                sampleItem.Code = 'Item-' + Math.random();
                items.push(currentApp.core.items.newItem(sampleItem));
            }

            currentApp.core.items.saveItems(items)
                .then(function(response) {
                    expect(response.entities).to.have.length.greaterThan(9);
                    done();
                })
                .catch(function(err) {
                    done(wrapError(err));
                })

@jordanwalsh23 jordanwalsh23 merged commit bd81184 into XeroAPI:master Jun 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant