Skip to content

Commit 5ffdebc

Browse files
committed
Update README
Fix indentation, spelling, grammar with focus on consistency.
1 parent cae1177 commit 5ffdebc

File tree

1 file changed

+71
-69
lines changed

1 file changed

+71
-69
lines changed

README.md

+71-69
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
1-
Angular Google GApi
1+
Angular Google GApi
22
=======================
33
[![Travis](https://img.shields.io/travis/maximepvrt/angular-google-gapi.svg)](https://travis-ci.org/maximepvrt/angular-google-gapi)
44
[![David](https://img.shields.io/david/maximepvrt/angular-google-gapi.svg)]()
55
[![npm](https://img.shields.io/npm/v/angular-google-gapi.svg)](https://www.npmjs.com/package/angular-google-gapi) [![Bower](https://img.shields.io/bower/v/angular-google-gapi.svg)](http://bower.io/search/?q=angular-google-gapi)
66

7-
An AngularJS module for use all Google Apis and your Google Cloud Endpoints (Google App Engine) with OAuth.
8-
This module use [Google APIs Client Library for JavaScript](https://developers.google.com/api-client-library/javascript/), available for all GApis.
7+
An AngularJS module for using all Google Apis and your Google Cloud Endpoints (Google App Engine) with OAuth.
8+
This module uses [Google APIs Client Library for JavaScript](https://developers.google.com/api-client-library/javascript/), available for all GApis.
99

1010
## Example
1111

12-
An example is executed here : http://maximepvrt.github.io/angular-google-gapi/
12+
[Demo](http://maximepvrt.github.io/angular-google-gapi/)
1313

14-
The code is available here : https://github.com/maximepvrt/angular-google-gapi/tree/gh-pages
14+
[Code](https://github.com/maximepvrt/angular-google-gapi/tree/gh-pages)
1515

1616
## Requirements
1717

1818
- [Angular.js](http://angularjs.org)
1919

2020
## Installation
2121
### Add library
22-
This module is available as bower package, install it with this command:
22+
This module is available as `bower` package, install it with this command:
2323

2424
```bash
25-
bower install angular-google-gapi
25+
$ bower install --save angular-google-gapi
2626
```
2727

28-
and it's available too as npm package, install it with this command:
28+
it's also available as a `npm` package, install it with this command:
2929

3030
```bash
31-
npm install angular-google-gapi
31+
$ npm install --save angular-google-gapi
3232
```
3333

3434
or you may download the [latest release](https://github.com/maximepvrt/angular-google-gapi/releases)
@@ -45,13 +45,13 @@ var app = angular.module('myModule', ['angular-google-gapi']);
4545
## Configuration
4646
### without Google Auth
4747

48-
add run in root module
48+
add `run()` in root module
4949

5050
```javascript
5151
app.run(['GApi', 'GAuth',
5252
function(GApi, GAuth) {
5353
var BASE = 'https://myGoogleAppEngine.appspot.com/_ah/api';
54-
GApi.load('myApiName','v1',BASE).then(function(resp) {
54+
GApi.load('myApiName', 'v1', BASE).then(function(resp) {
5555
console.log('api: ' + resp.api + ', version: ' + resp.version + ' loaded');
5656
}, function(resp) {
5757
console.log('an error occured during loading api: ' + resp.api + ', resp.version: ' + version);
@@ -61,7 +61,7 @@ app.run(['GApi', 'GAuth',
6161
```
6262
### with Google Auth
6363

64-
add run in root module
64+
add `run()` in root module
6565

6666
```javascript
6767
app.run(['GAuth', 'GApi', 'GData', '$state', '$rootScope',
@@ -72,55 +72,56 @@ app.run(['GAuth', 'GApi', 'GData', '$state', '$rootScope',
7272
var CLIENT = 'yourGoogleAuthAPIKey';
7373
var BASE = 'https://myGoogleAppEngine.appspot.com/_ah/api';
7474

75-
GApi.load('myApiName','v1',BASE);
76-
GApi.load('calendar','v3'); // for google api (https://developers.google.com/apis-explorer/)
75+
GApi.load('myApiName','v1',BASE);
76+
GApi.load('calendar','v3'); // for google api (https://developers.google.com/apis-explorer/)
7777

78-
GAuth.setClient(CLIENT);
79-
GAuth.setScope("https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/calendar.readonly"); // default scope is only https://www.googleapis.com/auth/userinfo.email
78+
GAuth.setClient(CLIENT)
79+
// default scope is only https://www.googleapis.com/auth/userinfo.email
80+
GAuth.setScope('https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/calendar.readonly');
8081

81-
// load the auth api so that it doesn't have to be loaded asynchronously
82-
// when the user clicks the 'login' button.
83-
// That would lead to popup blockers blocking the auth window
84-
GAuth.load();
85-
86-
// or just call checkAuth, which in turn does load the oauth api.
87-
// if you do that, GAuth.load(); is unnecessary
82+
// load the auth api so that it doesn't have to be loaded asynchronously
83+
// when the user clicks the 'login' button.
84+
// That would lead to popup blockers blocking the auth window
85+
GAuth.load();
86+
87+
// or just call checkAuth, which in turn does load the oauth api.
88+
// if you do that, GAuth.load(); is unnecessary
8889
GAuth.checkAuth().then(
8990
function (user) {
90-
console.log(user.name + 'is login')
91+
console.log(user.name + ' is logged in');
9192
$state.go('webapp.home'); // an example of action if it's possible to
92-
// authenticate user at startup of the application
93+
// authenticate user at startup of the application
9394
},
9495
function() {
95-
$state.go('login'); // an example of action if it's impossible to
96-
// authenticate user at startup of the application
96+
$state.go('login'); // an example of action if it's impossible to
97+
// authenticate user at startup of the application
9798
}
9899
);
99100
}
100101
]);
101102
```
102103

103-
### GApi.load Error handling
104+
### `GApi.load` Error handling
104105

105106
```javascript
106-
GApi.load('myApiName','v1',BASE)
107+
GApi.load('myApiName', 'v1', BASE)
107108
.catch(function(api, version) {
108109
console.log('an error occured during loading api: ' + api + ', version: ' + version);
109110
});
110111
```
111112

112-
## Use
113+
## Usage
113114

114115
### Execute your api without params
115116

116117
```javascript
117118
app.controller('myController', ['$scope', 'GApi',
118119
function myController($scope, GApi) {
119-
GApi.execute('youApi', 'you.api.method.name').then( function(resp) {
120-
$scope.value = resp;
121-
}, function() {
122-
console.log("error :(");
123-
});
120+
GApi.execute('youApi', 'you.api.method.name').then(function(resp) {
121+
$scope.value = resp;
122+
}, function() {
123+
console.log('error :(');
124+
});
124125
}
125126
]);
126127
```
@@ -130,11 +131,11 @@ app.controller('myController', ['$scope', 'GApi',
130131
```javascript
131132
app.controller('myController', ['$scope', 'GApi',
132133
function myController($scope, GApi) {
133-
GApi.execute('youApi', 'you.api.method.name', {parm1: value}).then( function(resp) {
134-
$scope.value = resp;
135-
}, function() {
136-
console.log("error :(");
137-
});
134+
GApi.execute('youApi', 'you.api.method.name', {param: value}).then(function(resp) {
135+
$scope.value = resp;
136+
}, function() {
137+
console.log('error :(');
138+
});
138139
}
139140
]);
140141
```
@@ -144,11 +145,11 @@ app.controller('myController', ['$scope', 'GApi',
144145
```javascript
145146
app.controller('myController', ['$scope', 'GApi',
146147
function myController($scope, GApi) {
147-
GApi.executeAuth('youApi', 'you.api.method.name').then( function(resp) {
148-
$scope.value = resp;
149-
}, function() {
150-
console.log("error :(");
151-
});
148+
GApi.executeAuth('youApi', 'you.api.method.name').then(function(resp) {
149+
$scope.value = resp;
150+
}, function() {
151+
console.log('error :(');
152+
});
152153
}
153154
]);
154155
```
@@ -158,59 +159,60 @@ app.controller('myController', ['$scope', 'GApi',
158159
```javascript
159160
app.controller('myController', ['$scope', 'GApi',
160161
function myController($scope, GApi) {
161-
GApi.executeAuth('youApi', 'you.api.method.name', {parm1: value}).then( function(resp) {
162-
$scope.value = resp;
163-
}, function() {
164-
console.log("error :(");
165-
});
162+
GApi.executeAuth('youApi', 'you.api.method.name', {param: value}).then(function(resp) {
163+
$scope.value = resp;
164+
}, function() {
165+
console.log('error :(');
166+
});
166167
}
167168
]);
168169
```
169170

170-
### Signup with google
171+
### Signup with Google
171172

172173
The login should be triggered by a user action, or you might run into issues with popup blockers. More information about this can be found in the [Google APIs Client Library Documentation](https://developers.google.com/api-client-library/javascript/features/authentication#specifying-your-client-id-and-scopes).
174+
173175
```javascript
174176
app.controller('myController', ['$scope', 'GAuth', '$state',
175177
function myController($scope, GAuth, $state) {
176-
177-
$scope.doSingup = function() {
178-
GAuth.login().then(function(user){
179-
console.log(user.name + 'is login')
180-
$state.go('webapp.home'); // action after the user have validated that
181-
// your application can access their Google account.
178+
$scope.doSignup = function() {
179+
GAuth.login().then(function(user) {
180+
console.log(user.name + ' is logged in');
181+
$state.go('webapp.home'); // action after the user have validated that
182+
// your application can access their Google account
182183
}, function() {
183-
console.log('login fail');
184+
console.log('login failed');
184185
});
185-
};
186+
};
186187
}
187188
]);
188189
```
189190

190191
### Get user info
191192

192-
Get user info after login is very simple.
193+
Get user info after login is very simple
193194

194195
```javascript
195196
app.controller('myController', ['$rootScope',
196197
function myController($rootScope) {
197-
console.log($rootScope.gdata.getUser().name)
198+
console.log($rootScope.gdata.getUser().name);
198199
}
199200
]);
200201
```
201202

202203
```html
203204
<h1>{{gdata.getUser().name}}</h1>
204205
```
205-
User object :
206-
- user.email
207-
- user.picture (url)
208-
- user.id (Google id)
209-
- user.name (Google account name or email if don't exist)
210-
- user.link (link to Google+ page)
206+
207+
User object:
208+
- `email`
209+
- `picture` (url)
210+
- `id` (Google id)
211+
- `name` (Google account name or email if don't exist)
212+
- `link` (link to Google+ page)
211213

212214
## Development
213215

214-
Gulp is used to minify angular-google-gapi.js (using Uglify). Execute 'npm install' (requires Node and NPM) to install the required packages.
216+
`gulp` is used to minify `angular-google-gapi.js` (using Uglify). Execute `npm install` (requires `Node.js` and `npm`) to install the required packages.
215217

216-
Run "gulp" to generate a minified version (angular-google-gapi.min.js). Note that this requires gulp to be installed globally (via 'npm install -g gulp').
218+
Run `gulp` to generate a minified version (`angular-google-gapi.min.js`). Note that this requires `gulp` to be installed globally (via `npm install -g gulp`).

0 commit comments

Comments
 (0)