Created
May 18, 2017 18:54
-
-
Save molekilla/9621482e662cfc56a354a3eebd12a310 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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