Skip to content

Instantly share code, notes, and snippets.

@dance2die

dance2die/index.js

Created Jun 19, 2017
Embed
What would you like to do?
firstAttempt()
export default class DemoMain {
constructor() {
this.goodReadsURL = `https://www.goodreads.com/shelf/list.xml`;
this.q = `key=${apiConfig.goodreadsKey}&user_id=${apiConfig.goodreadsUserID}&page=1`;
this.url = `${this.goodReadsURL}?${this.q}`;
}
logResult(url) {
axios.get(url, { params: { format: "json" } })
.then((yqlResponse) => {
let data = yqlResponse.data;
// DefiantJS XPath query for user shelf for "read" section.
let search = JSON.search(data, "//*/user_shelf[name='read']");
console.log(search);
}).catch((error) => {
alert(`error: ${error}`);
});
}
firstAttempt() {
this.logResult(this.url);
}
}
var demo = new DemoMain();
demo.firstAttempt();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.