Skip to content

Commit

Permalink
Updated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
IonicaBizau committed Apr 26, 2016
1 parent b9047bc commit 3d9b305
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 2 deletions.
4 changes: 3 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ Contributions are more than welcome!

Thanks! :sweat_smile:



[1]: https://github.com/IonicaBizau/nodeice/issues

[2]: https://github.com/IonicaBizau/code-style
[2]: https://github.com/IonicaBizau/code-style
60 changes: 60 additions & 0 deletions DOCUMENTATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
## Documentation

You can see below the API reference of this module.

### `Invoice(options)`
This is the constructor that creates a new instance containing the needed
methods.

#### Params
- **Object** `options`: The options for creating the new invoice:
- `config` (Object):
- `template` (String): The HTML root template.
- `data` (Object):
- `currencyBalance` (Object):
- `main` (Number): The main balance.
- `secondary` (Number): The converted main balance.
- `tasks` (Array): An array with the tasks (description of the services you did).
- `invoice` (Object): Information about invoice.
- `seller` (Object): Information about seller.
- `buyer` (Object): Information about buyer.

### `initTemplates(callback)`
Inits the HTML templates.

#### Params
- **Function** `callback`: The callback function.

### `toHtml(output, callback)`
Renders the invoice in HTML format.

#### Params
- **String** `output`: An optional path to the output file.
- **Function** `callback`: The callback function.

#### Return
- **Invoice** The `Nodeice` instance.

### `convertToSecondary(input)`
Converts a currency into another currency according to the currency
balance provided in the options

#### Params
- **Number** `input`: The number that should be converted

#### Return
- **Number** The converted input

### `toPdf(options, callback)`
Renders invoice as pdf

#### Params
- **Object|String|Stream** `options`: The path the output pdf file, the stream object, or an object containing:

- `output` (String|Stream): The path to the output file or the stream object.
- `converter` (Object): An object containing custom settings for the [`phantom-html-to-pdf`](https://github.com/pofider/phantom-html-to-pdf).
- **Function** `callback`: The callback function

#### Return
- **Invoice** The Invoice instance

10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

[![nodeice](http://i.imgur.com/NuF1OI0.png)](#)

# nodeice [![PayPal](https://img.shields.io/badge/%24-paypal-f39c12.svg)][paypal-donations] [![Version](https://img.shields.io/npm/v/nodeice.svg)](https://www.npmjs.com/package/nodeice) [![Downloads](https://img.shields.io/npm/dt/nodeice.svg)](https://www.npmjs.com/package/nodeice) [![Get help on Codementor](https://cdn.codementor.io/badges/get_help_github.svg)](https://www.codementor.io/johnnyb?utm_source=github&utm_medium=button&utm_term=johnnyb&utm_campaign=github)
Expand All @@ -12,8 +13,11 @@
$ npm i --save nodeice
```


## :clipboard: Example



```js
const Invoice = require("nodeice");

Expand Down Expand Up @@ -123,6 +127,7 @@ require("http").createServer((req, res) => {

## :memo: Documentation


### `Invoice(options)`
This is the constructor that creates a new instance containing the needed
methods.
Expand Down Expand Up @@ -179,9 +184,12 @@ Renders invoice as pdf
#### Return
- **Invoice** The Invoice instance



## :yum: How to contribute
Have an idea? Found a bug? See [how to contribute][contributing].


## :scroll: License

[MIT][license] © [Ionică Bizău][website]
Expand All @@ -192,4 +200,4 @@ Have an idea? Found a bug? See [how to contribute][contributing].
[license]: http://showalicense.com/?fullname=Ionic%C4%83%20Biz%C4%83u%20%3Cbizauionica%40gmail.com%3E%20(http%3A%2F%2Fionicabizau.net)&year=2014#license-mit
[website]: http://ionicabizau.net
[contributing]: /CONTRIBUTING.md
[docs]: /DOCUMENTATION.md
[docs]: /DOCUMENTATION.md

0 comments on commit 3d9b305

Please sign in to comment.