Skip to content

CapyTheBeara/ember-google-api-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Work In Progress

Initialization

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
}) ;

Drive Files

Find Files

  • 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) { /* ... */ });

Create a File

var file = {
  title: 'foo.txt',
  mimeType: 'text/plain',
  parents: [{ id: 'appdata' }],
  content: 'Lorem ipsum...'
};

egc.insert(file)
   .then(function(_file) { file.id = _file.id });

Update a File

file.title = 'FOO.txt';
file.content = 'LOREM IPSUM...';
egc.update(file)
   .then(function(file) { /* ... */ });

Destroy a File

egc.destroy(file.id);

About

Ember wrapper for the Google API JavaScript client

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published