Skip to content

Instantly share code, notes, and snippets.

@molekilla
Created May 18, 2017 18:54
Show Gist options
  • Save molekilla/9621482e662cfc56a354a3eebd12a310 to your computer and use it in GitHub Desktop.
Save molekilla/9621482e662cfc56a354a3eebd12a310 to your computer and use it in GitHub Desktop.
const bot$ = Rx.Observable.from(request(postReq));
bot$.mergeMap((body) => {
const byCedulaResp = menio.parse(body, 'subscribers');
const req = Object.assign({}, postReq, {
form: {
selectsuscriptor: byCedulaResp.subs[0],
}
});
return Rx.Observable.from(request(req));
})
.mergeMap((body) => {
const bySubscriberResp = menio.parse(body, 'accounts');
const req = Object.assign({}, postReq, {
form: {
selectcuenta: bySubscriberResp.accounts[0],
}
});
return Rx.Observable.from(request(req));
})
.subscribe(
(n) => {
options.success(n, {});
console.log(n);
},
(e) => {
options.error(e);
},
() => {}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment