Sha256: c453907935d59f671d2d9af2dbc7075033f6539741144a8564a2356070e4dfcc
Contents?: true
Size: 710 Bytes
Versions: 3
Compression:
Stored size: 710 Bytes
Contents
module Goodreads module Shelves # Get books from a user's shelf def shelf(user_id, shelf_name, options = {}) options = options.merge(shelf: shelf_name, v: 2) data = request("/review/list/#{user_id}.xml", options) reviews = data["reviews"]["review"] books = [] unless reviews.nil? # one-book results come back as a single hash reviews = [reviews] unless reviews.instance_of?(Array) books = reviews.map { |e| Hashie::Mash.new(e) } end Hashie::Mash.new( start: data["reviews"]["start"].to_i, end: data["reviews"]["end"].to_i, total: data["reviews"]["total"].to_i, books: books ) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
goodreads-0.6.1 | lib/goodreads/client/shelves.rb |
goodreads-0.6.0 | lib/goodreads/client/shelves.rb |
goodreads-0.5.0 | lib/goodreads/client/shelves.rb |