node-goodreads icon indicating copy to clipboard operation
node-goodreads copied to clipboard

date_added and shelves properties on getSingleShelf results?

Open m52go opened this issue 7 years ago • 7 comments

i don't see date_added or shelves properties in the results returned by an authenticated getSingleShelf call.

but when i run the corresponding call ("Get the books on a members shelf" on the Goodreads API documentation) in postman, with nothing but a developer key (not authenticated, just specifying a user id), i get those fields.

am i missing something? why doesn't getSingleShelf return those fields?

m52go avatar Jul 26 '17 12:07 m52go

Looks like that method doesn't provide the full response to the callback:

https://github.com/bdickason/node-goodreads/blob/master/lib/goodreads/goodreads.js#L123.

Does result contain all the fields you expect?

rharriso avatar Jul 26 '17 14:07 rharriso

Upon looking through past commits of goodreads.js, it seems like I ended up with an older commit of this module.

I'm using this module through Meteor, and I installed it earlier this month. I assumed Meteor just gets the most up-to-date version on npm, but apparently not. I'll sort this out and respond back here.

m52go avatar Jul 26 '17 17:07 m52go

We haven't published a new version in a while. It's not the most active project. I would try using master, or a the current latest commit hash for now.

rharriso avatar Jul 26 '17 17:07 rharriso

Yeah thanks, not sure why Meteor pulled in such an old version. Didn't even think to check that. I'm going to specify the latest version and see what happens.

m52go avatar Jul 26 '17 17:07 m52go

So, I just ran npm install on my machine independent of Meteor. It also pulled an older version of the module.

Is it possible that npm is pointing to an older release?

m52go avatar Jul 26 '17 17:07 m52go

As I said, we haven't published a version in a while, so the repo is ahead.

https://stackoverflow.com/questions/39732397/install-specific-branch-from-github-using-npm

I would recommend:

npm install https://github.com/bdickason/node-goodreads.git\#[commit-hash] --save

# our last commit 
npm install https://github.com/bdickason/node-goodreads.git\#a70b3b9 --save

rharriso avatar Jul 26 '17 18:07 rharriso

Oh, thanks. Didn't realize you're referring to the npm repo too.

Going back to the original issue, looks like there's something else going on.

The data I'm looking for should actually be inside that result.books[0].book element you originally mentioned.

For reference, I've included a plain HTTP request and a request from this wrapper. You'll notice all book data inside that book element is not coming through in the book element in the wrapper (e.g., date_added and shelves, among a few other fields):

Plain HTTP Response

<GoodreadsResponse>
    <Request>
        <authentication>true</authentication>
        <key>
            <![CDATA[0N3gcLWFewCL9fG80Z12A]]>
        </key>
        <method>
            <![CDATA[review_list]]>
        </method>
    </Request>
    <reviews start="1" end="100" total="284">
        <review>
            <id>2066560505</id>
            <book>
                <id type="integer">5140563</id>
                <isbn>0300033869</isbn>
                <isbn13>9780300033861</isbn13>
                <text_reviews_count type="integer">12</text_reviews_count>
                <title>Stabilizing an Unstable Economy: A Twentieth Century Fund Report</title>
                <title_without_series>Stabilizing an Unstable Economy: A Twentieth Century Fund Report</title_without_series>
                <image_url>https://s.gr-assets.com/assets/nophoto/book/111x148-bcc042a9c91a29c1d680899eff700a03.png</image_url>
                <small_image_url>https://s.gr-assets.com/assets/nophoto/book/50x75-a91bf249278a81aabab721ef782c4a74.png</small_image_url>
                <large_image_url/>
                <link>https://www.goodreads.com/book/show/5140563-stabilizing-an-unstable-economy</link>
                <num_pages>353</num_pages>
                <format>Hardcover</format>
                <edition_information/>
                <publisher>Yale University Press</publisher>
                <publication_day>10</publication_day>
                <publication_year>1986</publication_year>
                <publication_month>9</publication_month>
                <average_rating>4.19</average_rating>
                <ratings_count>169</ratings_count>
                <description></description>
                <authors>
                    <author>
                        <id>80153</id>
                        <name>Hyman P. Minsky</name>
                        <role></role>
                        <image_url nophoto='true'>
                            <![CDATA[https://s.gr-assets.com/assets/nophoto/user/u_200x266-e183445fd1a1b5cc7075bb1cf7043306.png]]>
                        </image_url>
                        <small_image_url nophoto='true'>
                            <![CDATA[https://s.gr-assets.com/assets/nophoto/user/u_50x66-632230dc9882b4352d753eedf9396530.png]]>
                        </small_image_url>
                        <link>
                            <![CDATA[https://www.goodreads.com/author/show/80153.Hyman_P_Minsky]]>
                        </link>
                        <average_rating>4.18</average_rating>
                        <ratings_count>303</ratings_count>
                        <text_reviews_count>28</text_reviews_count>
                    </author>
                </authors>
                <published>1986</published>
                <work>
                    <id>5207460</id>
                </work>
            </book>
            <rating>0</rating>
            <votes>0</votes>
            <spoiler_flag>false</spoiler_flag>
            <spoilers_state>none</spoilers_state>
            <shelves>
                <shelf name="to-read" exclusive="true" review_shelf_id="1719721928" sortable="true" />
            </shelves>
            <recommended_for></recommended_for>
            <recommended_by></recommended_by>
            <started_at></started_at>
            <read_at></read_at>
            <date_added>Thu Jul 20 12:07:55 -0700 2017</date_added>
            <date_updated>Thu Jul 20 12:07:55 -0700 2017</date_updated>
            <read_count>0</read_count>
            <body></body>
            <comments_count>0</comments_count>
            <url>
                <![CDATA[https://www.goodreads.com/review/show/2066560505]]>
            </url>
            <link>
                <![CDATA[https://www.goodreads.com/review/show/2066560505]]>
            </link>
            <owned>0</owned>
        </review>
    </reviews>
</GoodreadsResponse>

Wrapper Response

"GoodreadsResponse": 
    "books": [
        "book": {
	"id":[{"_":"13131661","$":{"type":"integer"}}],	
	"isbn":["1610391268"],
	"isbn13":["9781610391269"],
	"text_reviews_count":[{"_":"26","$":{"type":"integer"}}],
	"title":["Paper Promises: Debt, Money, and the New World Order"],
	"title_without_series":["Paper Promises: Debt, Money, and the New World Order"],
	"image_url":["http://s.gr-asset
s.com/assets/nophoto/book/111x148-bcc042a9c91a29c1d680899eff700a03.png"],
	"small_image_url":["http://s.gr-assets.com/assets/nophoto/book/
50x75-a91bf249278a81aabab721ef782c4a74.png"],
	"large_image_url":[""],"link":["http://www.goodreads.com/book/show/13131661-paper-promises"
],						
	"num_pages":["304"],	
	"format":["Hardcover"],	"edition_information":[""],
	"publisher":["PublicAffairs"],
	"publication_day":["7"],
	"publicaton_year":["2012"],
	"publication_month":["2"],
	"average_rating":["3.92"],
	"ratings_count":["367"],
	"description":["LOTS OF WORDS GO HERE"],
	"authors":[{"author":[{"id":["474415"],"name":["Philip Coggan"],"role":[""],"image_url":[{"_":"\nhttp://s.gr-assets.com/assets/nophoto/user/m_200x266-d279b33f8eec0f27b7272477f09806be.png\n","$": {"nophoto":"true"}}],"small_image_url":[{"_":"\nhttp://s.gr-assets.com/assets/nophoto/user/m_50x66-82093808bca726cb3249a493fbd3bd0f.png\n","$":{"nophoto":"true"}}],"link":["http://www.goodreads.com/author/show/474415.Philip_Coggan"],"average_rating":["3.80"],"ratings_count":["603"],"text_reviews_count":["57"]}]}]
        }
    ]
}

m52go avatar Jul 26 '17 20:07 m52go