Sha256: 2fabae23c93219d9d480575a2702274b54d8e006c7f92363f735885253fcabd1
Contents?: true
Size: 726 Bytes
Versions: 9
Compression:
Stored size: 726 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] if !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
9 entries across 9 versions & 2 rubygems