Skip to content

Commit

Permalink
Doc fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
kirill-konshin committed Nov 24, 2015
1 parent a7773fa commit 7945e29
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 21 deletions.
27 changes: 7 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Add the following to your HTML:
</script>
```

**Not recommended!** If you are in a hurry, you can use bundled version with all dependencies:
**Not recommended!** You also can use bundle version with all dependencies:

```html
<script type="text/javascript" src="path-to-scripts/ringcentral/build/ringcentral-bundle.js"></script><!-- or ringcentral-bundle.min.js -->
Expand Down Expand Up @@ -100,9 +100,6 @@ require.config({
require(['ringcentral', 'es6-promise', 'fetch'], function(SDK, Promise) {
Promise.polyfill();
// or
SDK.externals._Promise = Promise;
var sdk = new SDK(...);
});
Expand All @@ -121,26 +118,16 @@ Make sure that polyfills are loaded before or together with SDK.
2. Require the SDK:

```js
var RingCentral = require('ringcentral');
var SDK = require('ringcentral');
var sdk = new SDK(...);
```

## Set things up for Browserify or Webpack

**!!! This is experimental !!!**

1. Install the NPM package:

```sh
npm install ringcentral --save
```

2. Require the SDK:

```js
var RingCentral = require('ringcentral');
```

3. Add the following to your `webpack.config.js`, path should be relative to Webpack configuration file:
1. Follow installation steps for NodeJS
2. Add the following to your `webpack.config.js`, path should be relative to Webpack configuration file:

```js
{
Expand Down Expand Up @@ -236,7 +223,7 @@ application can log in so that it can access the features of the API.
## Login
Login is accomplished by calling the `platform.authorize()` method of the Platform singleton with username, extension
Login is accomplished by calling the `platform.login()` method of the Platform singleton with username, extension
(optional), and password as parameters. A `Promise` instance is returned, resolved with an AJAX `Response` object.
```js
Expand Down Expand Up @@ -267,7 +254,7 @@ and such.
Login can, of course, fail - a user can enter the incorrect password or mistype their user name.
To handle cases where login fails, you can provide an error handler function in a call to the promise's `catch` method.
To handle cases where login fails, you can provide an error handler function in a call to the Promise's `catch` method.
To keep this example simple, a simple JavaScript alert is being used. In a real application, you will want to provide
a good UX in your login form UI.

Expand Down
4 changes: 3 additions & 1 deletion src/http/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,9 @@ export default class Client extends Observable {
// Sanity checks
if (!init.url) throw new Error('Url is not defined');
if (!init.method) init.method = 'GET';
if (init.method && Client._allowedMethods.indexOf(init.method) < 0) throw new Error('Method has wrong value: ' + init.method);
if (init.method && Client._allowedMethods.indexOf(init.method.toUpperCase()) < 0) {
throw new Error('Method has wrong value: ' + init.method);
}

// Defaults
init.credentials = init.credentials || 'include';
Expand Down

0 comments on commit 7945e29

Please sign in to comment.