sms_bill
v0.0.2
Published
A library to bill SMS messages according to encoding, escaped characters, etc
Downloads
36
Maintainers
Readme
sms_bill
This library is used to bill SMS messages according to its encoding, number of segments, etc.
Installing
Add this library to your package.json configuration:
"dependencies": {
"sms_bill": "latest"
}
Using it
var sms_bill = require('sms_bill');
var result = sms_bill.bill(text, segmentCost, encoding);
- text: Is a string, the full text of the message to be billed.
- segmentCost: Usually a float. Cost for each segment of the message.
- encoding: Optional. If not present will try to autodetect the encoding and
choose one of
bit7
orucs2
. If present, will bill according to the maximum number of characters allowed per segment for the chosen encoding.
More examples can be found in the tests.
The result object will contain the total cost for the message, the number of segments billed, the encoding used, the maximum number of characters per segment allowed, and a lot more of information useful for debugging and tracing.
Encodings supported
Developers
This project uses standard npm scripts. Current tasks include:
- test: Runs Mocha tests.
- jsdoc: Runs JSDoc3.
- eslint: Runs ESLint.
- coverage: Runs the tests and then Instanbul to get a coverage report.
- build: This is the default task, and will run all the other tasks.
Validating Input and Output
In the schema directory you will find the JSON Schema definitions.
Inputs
Outputs
Running an npm task
To run a task, just do:
npm run build
Contributing
To contribute:
- Make sure you open a concise and short pull request.
- Throw in any needed unit tests to accomodate the new code or the changes involved.
- Run
npm run build
and make sure everything is ok before submitting the pull request (make eslint happy). - Your code must comply with the Javascript Standard Style, ESLint should take care of that.
License
The source code is released under Apache 2 License.
Check LICENSE file for more information.