From 9c4d56fba60597e8b9cd8babcd3936211bb38464 Mon Sep 17 00:00:00 2001 From: florapdx Date: Sun, 30 Nov 2014 20:33:46 -0800 Subject: [PATCH] add example script for sprintly --- Samples/sprintly.js | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 Samples/sprintly.js diff --git a/Samples/sprintly.js b/Samples/sprintly.js new file mode 100644 index 00000000..07ec633f --- /dev/null +++ b/Samples/sprintly.js @@ -0,0 +1,35 @@ +// Sprintly is a project management software-as-a-service product +// designed to bridge the communication gap between developers and team managers. +// With Sprintly, you can manage development projects and track team progress in real-time. +// Learn more about Sprintly's feature set and integrations at https://sprint.ly + +// We recently released a Javascript SDK for accessing Sprintly data via our Python-based API. +// Find the code and additional documentation at https://github.com/sprintly/sprintly-data. +// Documentation for the Python API can be found at https://sprintly.uservoice.com/knowledgebase/topics/15784-api + + +// This example pulls all of the items in your project backlog and logs their count. +// Note: you need a Sprintly account and at least one product with some tasks ('items') +// added to it in order to get started. + +// Install the SDK via npm: $ npm install --save sprintly/sprintly-data +var sprintly = require('sprintly-data'); + +var email = window.prompt('sprintly email:'); +var apiKey = window.prompt('sprintly API key:'); + +// Initialize the sprintly client +// The client returns a products Backbone collection as well as a user Backbone model +var client = sprintly.createClient(email, apiKey); + +// Fetch your Sprintly products' data. (note: returns jquery promise) +// Get the product that you'd like to pull items from. +var products = client.products.fetch(); +var myProduct = client.products.get(1); + +// Pull in all items in your project's backlog. (note: returns jquery promise) +// When all backlog items are fetched, log the collection count to the console. +var backlogCollection = myProduct.getItemsByStatus('backlog'); +backlogCollection.done(function() { + console.log(backlogCollection.length); +}); \ No newline at end of file