Skip to content

Commit

Permalink
Merge pull request #12 from revolunet/cleanup
Browse files Browse the repository at this point in the history
fix: fix #10 and github actions
  • Loading branch information
revolunet committed Nov 5, 2021
2 parents 1f1a441 + c6338c2 commit 4d91aae
Show file tree
Hide file tree
Showing 21 changed files with 3,533 additions and 3,479 deletions.
3 changes: 2 additions & 1 deletion .babelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"presets": ["es2015", "stage-0"]
"presets": ["@babel/env"],
"plugins": ["@babel/plugin-proposal-object-rest-spread"]
}
21 changes: 0 additions & 21 deletions .circleci/config.yml

This file was deleted.

2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules/**/*
dist/**/*
14 changes: 11 additions & 3 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
{
"parser": "babel-eslint",
"extends": "eslint-config-airbnb",
"parser": "@babel/eslint-parser",
"parserOptions": {
"ecmaVersion": 6,
"sourceType": "module",
"ecmaFeatures": {
"jsx": false
}
},
"extends": ["eslint:recommended"],
"env": {
"es6": true,
"browser": true,
"node": true
},
"rules": {

"no-unused-vars": "warn"
}
}
26 changes: 26 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Release

on:
workflow_dispatch:
push:
branches: [master, alpha, beta, next]

jobs:
release:
name: Release
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Semantic Release
uses: cycjimmy/semantic-release-action@v2
with:
semantic_version: 17
extra_plugins: |
@semantic-release/changelog@5.0.1
@semantic-release/git@9.0.0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
29 changes: 29 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Test

on:
push:
branches: ["*"]

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: lts/*

- name: Install
run: npm install

- name: Build
run: npm run build

- name: Lint
run: npm run lint

- name: Unit tests
run: npm test
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
node_modules
*.DS_Store
creds.js
test.js
test.js
dist
93 changes: 47 additions & 46 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,40 +14,42 @@ For example i use a Stripe webhook to automate actions in Sellsy.

## Features

- Works with your oauth private app id
- Simple promise call for all methods in http://api.sellsy.fr/documentation/methodes
- Works with your oauth private app id
- Simple promise call for all methods in http://api.sellsy.fr/documentation/methodes

## QuickStart

`npm i --save node-sellsy`

```js

var Sellsy = require('node-sellsy');
var Sellsy = require("node-sellsy");

var sellsy = new Sellsy({
creds: {
consumerKey: 'myConsumerKey',
consumerSecret: 'myConsumerSecret',
userToken: 'myUserToken',
userSecret: 'myUserSecret'
}
consumerKey: "myConsumerKey",
consumerSecret: "myConsumerSecret",
userToken: "myUserToken",
userSecret: "myUserSecret",
},
});

var params = {
search: {
contains: 'test',
}
contains: "test",
},
};

sellsy.api({
method: 'Client.getList',
params: params
}).then(data => {
console.log('data', data);
}).catch(e => {
console.log('error:', e);
});
sellsy
.api({
method: "Client.getList",
params: params,
})
.then((data) => {
console.log("data", data);
})
.catch((e) => {
console.log("error:", e);
});
```

## API
Expand All @@ -65,32 +67,31 @@ Then, define the endPoint when creating your `Sellsy` instance :
```js
var sellsy = new Sellsy({
creds,
endPoint: 'http://path/to/sellsy/proxy'
endPoint: "http://path/to/sellsy/proxy",
});
```


### Higher-level API methods :

#### Customer

- `sellsy.customers.create(data)`
- `sellsy.customers.get({ email: 'customer@gmail.com' })`
- `sellsy.customers.create(data)`
- `sellsy.customers.get({ email: 'customer@gmail.com' })`

#### Document

- `sellsy.documents.create(data)`
- `sellsy.documents.createPayment(docType, docId, paymentData)`
- `sellsy.documents.getList(docType, search)`
- `sellsy.documents.getById(docType, docId)`
- `sellsy.documents.updateStep(docType, docId, step)`
- `sellsy.documents.create(data)`
- `sellsy.documents.createPayment(docType, docId, paymentData)`
- `sellsy.documents.getList(docType, search)`
- `sellsy.documents.getById(docType, docId)`
- `sellsy.documents.updateStep(docType, docId, step)`

## Scripts

- **npm run readme** : `node ./node_modules/node-readme/bin/node-readme.js`
- **npm run test** : `find ./spec -iname '*.spec.js' -exec ./node_modules/.bin/babel-node {} \; | ./node_modules/.bin/tap-spec`
- **npm run zuul** : `./node_modules/zuul/bin/zuul -- spec/**/*.spec.js`
- **npm run build** : `babel -d ./dist ./src`
- **npm run readme** : `node ./node_modules/node-readme/bin/node-readme.js`
- **npm run test** : `find ./spec -iname '*.spec.js' -exec ./node_modules/.bin/babel-node {} \; | ./node_modules/.bin/tap-spec`
- **npm run zuul** : `./node_modules/zuul/bin/zuul -- spec/**/*.spec.js`
- **npm run build** : `babel -d ./dist ./src`

## Examples

Expand All @@ -99,17 +100,17 @@ var sellsy = new Sellsy({
```js
let sellsy = new Sellsy({
creds: {
consumerKey: 'myConsumerKey',
consumerSecret: 'myConsumerSecret',
userToken: 'myUserToken',
userSecret: 'myUserSecret'
}
consumerKey: "myConsumerKey",
consumerSecret: "myConsumerSecret",
userToken: "myUserToken",
userSecret: "myUserSecret",
},
});

const customerIdent = "1234";
const amountHorsTaxes = 42;

sellsy.customers.get({ ident: customerIdent }).then(customer => {
sellsy.customers.get({ ident: customerIdent }).then((customer) => {
const documentData = {
document: {
doctype: "invoice",
Expand All @@ -118,26 +119,27 @@ sellsy.customers.get({ ident: customerIdent }).then(customer => {
currency: "1",
displayedDate: new Date().getTime() / 1000,
subject: "Sujet de la facture",
tags: "bookeo,stripe"
tags: "bookeo,stripe",
},
row: {
"1": {
1: {
// use 'item' for object from catalog
row_type: "once",
row_name: "titre ligne facture",
row_linkedid: null,
row_notes: "notes ligne facture",
row_tax: 20,
row_unitAmount: amountHorsTaxes,
row_qt: 1
}
}
row_qt: 1,
},
},
};

return sellsy.documents.create(documentData);
});
```
Then you can use

Then you can use

`sellsy.documents.updateStep(createdDocument.type, createdDocument.id, 'paid')` to mark invoice as paid and `sellsy.documents.createPayment` to record the payment method

Expand Down Expand Up @@ -188,11 +190,10 @@ Then you can use
duration: 1.8s
```


## Author

Julien Bouquillon <julien@bouquillon.com> http://github.com/revolunet and [contributors](https://github.com/revolunet/node-sellsy/graphs/contributors)

## License

- **MIT** : http://opensource.org/licenses/MIT
- **MIT** : http://opensource.org/licenses/MIT
64 changes: 0 additions & 64 deletions dist/Customers.js

This file was deleted.

Loading

0 comments on commit 4d91aae

Please sign in to comment.