Skip to content

Commit

Permalink
docs: add description to README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
borodayev committed Mar 30, 2018
1 parent 4731f5f commit 21ce0aa
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ after_success:
- if [[ "$TRAVIS_JOB_NUMBER" == *.1 && "$TRAVIS_BRANCH" == "master" && "$TRAVIS_PULL_REQUEST" == "false" ]]; then bash <(curl -s https://codecov.io/bash); fi
- if [[ "$TRAVIS_JOB_NUMBER" == *.1 && "$TRAVIS_BRANCH" == "master" && "$TRAVIS_PULL_REQUEST" == "false" ]]; then npm run semantic-release; fi
branches:
only:
- prod
except:
- /^v\d+\.\d+\.\d+$/
69 changes: 66 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,70 @@
[![npm](https://img.shields.io/npm/dt/graphql-compose-json.svg)](http://www.npmtrends.com/graphql-compose-json)
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
[![Greenkeeper badge](https://badges.greenkeeper.io/graphql-compose/graphql-compose-json.svg)](https://greenkeeper.io/)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
-->
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release) -->

This is a wrapper for AWS.SNS and SMSC API

This is a wrapper for [AWS.SNS](https://aws.amazon.com/sns/) and [SMSC API](https://smsc.ru).

## Installation


```bash
yarn add sms-sender
```

## Example

There are two providers `Smsc.js` (default) and `Sns.js`. If you want to use `Sns.js` do not forget to add `aws-sdk` optional dependency.

Here is example for using this wrapper with RegExp:

```js
// @flow

import Smsc from '../../src/transporters/Smsc';
import Sns from '../../src/transporters/Sns';

// don't forget to put your credentials
const providers = {
smsc: new Smsc({
login: '',
password: '',
}),

// put here or in ~/.aws/credentials
sns: new Sns({
region: '',
accessKeyId: '',
secretAccessKey: '',
}),
};

function getProvider(providerName: string, defaultName?: string = 'smsc'): any {
const regexp = RegExp(providerName, 'g');
let provider;
Object.keys(providers).forEach(name => {
if (regexp.test(name)) {
provider = providers[name];
} else {
provider = providers[defaultName];
}
});

return provider;
}

const provider = getProvider('sm');

provider.sendSms('77718637484', 'test').then(res => console.log(res));

```

Other examples are available in [./examples](https://github.com/FrankAst/sms-sender/tree/master/examples).

## Contribution
Feel free to submit pull request to us. Also, be sure all tests has passed otherwise pull request won't be accepted.

## License

[MIT](https://github.com/FrankAst/sms-sender/blob/master/LICENSE.md)
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
"scripts": {
"demo-db": "./node_modules/.bin/babel-node ./examples/with_db/index.js",
"demo-regexp": "./node_modules/.bin/babel-node ./examples/by_regexp/index.js",
"demo-retry-another": "./node_modules/.bin/babel-node ./examples/retry_another/index.js",
"build": "npm run build-cjs && npm run build-flow",
"build-cjs": "rimraf lib && babel src --ignore __tests__,__mocks__,__fixtures__ -d lib",
"build-flow": "find ./src -name '*.js' -not -path '*/__*' | while read filepath; do cp $filepath `echo $filepath | sed 's/\\/src\\//\\/lib\\//g'`.flow; done",
Expand Down

0 comments on commit 21ce0aa

Please sign in to comment.