percolatestudio / meteor-google-api

A simple API encapsulating some common patterns regarding Google's APIs
https://atmospherejs.com/percolate/google-api
MIT License
48 stars 30 forks source link

The secret of this module: wraps HTTP.[verb] #18

Closed wizonesolutions closed 9 years ago

wizonesolutions commented 9 years ago

Took me a while to figure this out; I was using a POST call to the Google Calendar API.

Most examples show resource being used in options, but with this package you have to do this:

var newEvent = GoogleApi.post('/calendar/v3/calendars/' + calendarId + '/events', {
  data: resource
}

This is because data is how you get JSON data into a request body using HTTP.post. This package is just a wrapper for that which tacks on your Google auth and refreshes your OAuth token if necessary. And also lets you make the call async.

I hope something like this can get put in the README...

tmeasday commented 9 years ago

Hey @wizonesolutions -- are you saying that we should update the README to more firmly state that this package is a wrapper around Meteor's HTTP library?

I'd be very happy to accept a PR that does so ;)

wizonesolutions commented 9 years ago

Done! https://github.com/percolatestudio/meteor-google-api/pull/19