Class: FeedBooks::Book
Overview
Book api object see feedbooks.com/api/books
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Class Method Summary collapse
-
.recent(limit = nil) ⇒ Object
get recent books (can be limited).
-
.recommended(limit = nil) ⇒ Object
get recommedations based on user profile the user needs to be authenticatided see Connection.
-
.search(txt, limit = nil) ⇒ Object
Search in books catalog returns an Array.
-
.top(limit = nil) ⇒ Object
get top books (can be limited).
Instance Method Summary collapse
-
#authors ⇒ Object
authors is an array of Author.
- #cover ⇒ Object
- #date ⇒ Object
- #description ⇒ Object
-
#file(format) ⇒ Object
give an url bases on asked format using the API results (other format may be available).
-
#initialize(id = nil) ⇒ Book
constructor
A new instance of Book.
- #language ⇒ Object
-
#lists(limit = nil) ⇒ Object
get an array of lists containing the book.
- #rights ⇒ Object
-
#similar(limit = nil) ⇒ Object
get similar books.
-
#subjects ⇒ Object
(also: #types)
subjects is an array of Type elements.
- #title ⇒ Object
Methods inherited from FBobject
#connection, connection, connection=, #connection=, from_xml
Constructor Details
#initialize(id = nil) ⇒ Book
Returns a new instance of Book.
184 185 186 |
# File 'lib/ruby-feedbooks.rb', line 184 def initialize(id=nil) @id=id end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
183 184 185 |
# File 'lib/ruby-feedbooks.rb', line 183 def id @id end |
Class Method Details
.recent(limit = nil) ⇒ Object
get recent books (can be limited)
257 258 259 |
# File 'lib/ruby-feedbooks.rb', line 257 def self.recent(limit=nil) generic_iterate("/books/recent.xml",limit) end |
.recommended(limit = nil) ⇒ Object
get recommedations based on user profile the user needs to be authenticatided see Connection
263 264 265 |
# File 'lib/ruby-feedbooks.rb', line 263 def self.recommended(limit=nil) generic_iterate("/recommendations.xml",limit) end |
.search(txt, limit = nil) ⇒ Object
Search in books catalog returns an Array
246 247 248 249 |
# File 'lib/ruby-feedbooks.rb', line 246 def self.search(txt,limit=nil) return [] if txt.strip.size==0 generic_iterate("/books/search.xml?query=#{URI.escape(txt)}",limit) end |
.top(limit = nil) ⇒ Object
get top books (can be limited)
252 253 254 |
# File 'lib/ruby-feedbooks.rb', line 252 def self.top(limit=nil) generic_iterate("/books/top.xml",limit) end |
Instance Method Details
#authors ⇒ Object
authors is an array of Author
194 195 196 197 |
# File 'lib/ruby-feedbooks.rb', line 194 def get_attr if @author==nil @author end |
#cover ⇒ Object
204 205 206 207 |
# File 'lib/ruby-feedbooks.rb', line 204 def cover get_attr if @title==nil @cover end |
#date ⇒ Object
199 200 201 202 |
# File 'lib/ruby-feedbooks.rb', line 199 def date get_attr if @date==nil @date end |
#description ⇒ Object
226 227 228 229 |
# File 'lib/ruby-feedbooks.rb', line 226 def description get_attr if @title==nil @description end |
#file(format) ⇒ Object
give an url bases on asked format using the API results (other format may be available)
221 222 223 224 |
# File 'lib/ruby-feedbooks.rb', line 221 def file(format) get_attr if @files==nil @files[format] end |
#language ⇒ Object
209 210 211 212 |
# File 'lib/ruby-feedbooks.rb', line 209 def language get_attr if @title==nil @language end |
#lists(limit = nil) ⇒ Object
get an array of lists containing the book
268 269 270 |
# File 'lib/ruby-feedbooks.rb', line 268 def lists(limit=nil) FeedBooks::List.send('generic_iterate',"/book/#{@id}/lists.xml",limit) end |
#rights ⇒ Object
214 215 216 217 |
# File 'lib/ruby-feedbooks.rb', line 214 def rights get_attr if @title==nil @rights end |
#similar(limit = nil) ⇒ Object
get similar books
241 242 243 |
# File 'lib/ruby-feedbooks.rb', line 241 def similar(limit=nil) self.class.generic_iterate("/book/#{@id}/similar.xml",limit) end |
#subjects ⇒ Object Also known as: types
subjects is an array of Type elements
233 234 235 236 |
# File 'lib/ruby-feedbooks.rb', line 233 def subjects get_attr if @title==nil @subject.collect{|s| FeedBooks::Type.new(s)} end |
#title ⇒ Object
188 189 190 191 |
# File 'lib/ruby-feedbooks.rb', line 188 def title get_attr if @title==nil @title end |