var egc = Ember.EGC.create({
apiKey: 'GOOGLE_API_KEY',
cliendId: 'GOOGLE_CLIENT_ID',
scope: 'https://www.googleapis.com/auth/drive.appdata' // or whatever scopes you need
});
egc.then(function() {
// Google's gapi client is loaded, ready and
// immediate authorization has occured
}, function() {
// Google's gapi client is load and ready, but
// immediate authorization failed
}) ;
- Find all files
egc.find()
.then(function(files) { /* ... */ });
- Find a file by id
egc.find('1234abc')
.then(function(file) { /* ... */ });
- Find using a Google API query
egc.find({ q: "title contains 'awesone sauce'"})
.then(function(files) { /* ... */ });
var file = {
title: 'foo.txt',
mimeType: 'text/plain',
parents: [{ id: 'appdata' }],
content: 'Lorem ipsum...'
};
egc.insert(file)
.then(function(_file) { file.id = _file.id });
file.title = 'FOO.txt';
file.content = 'LOREM IPSUM...';
egc.update(file)
.then(function(file) { /* ... */ });
egc.destroy(file.id);