Class: FeedBooks::Author
Overview
Author object see feedbooks.com/api/authors
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Class Method Summary collapse
-
.from_h(h) ⇒ Object
:nodoc:.
-
.recent(limit = nil) ⇒ Object
Recent authors.
-
.search(txt, limit = nil) ⇒ Object
Search through author catalog.
-
.top(limit = nil) ⇒ Object
Top authors (by download).
Instance Method Summary collapse
- #biography ⇒ Object
- #birth ⇒ Object
-
#books(limit = nil) ⇒ Object
Array of books written by this author.
-
#books_count ⇒ Object
Number of books written by this author.
- #death ⇒ Object
-
#downloads_count ⇒ Object
Count of downloaded books from author.
- #firstname ⇒ Object
-
#fullname ⇒ Object
virtual attribute fullname based on firstname and name.
-
#fullname=(txt) ⇒ Object
:nodoc:.
-
#initialize(id = nil) ⇒ Author
constructor
A new instance of Author.
- #name ⇒ Object
-
#recent_books(limit = nil) ⇒ Object
Array of recent books written by this author.
-
#top_books(limit = nil) ⇒ Object
Array of top books written by this author.
Methods inherited from FBobject
#connection, connection, connection=, #connection=, from_xml
Constructor Details
#initialize(id = nil) ⇒ Author
Returns a new instance of Author.
308 309 310 |
# File 'lib/ruby-feedbooks.rb', line 308 def initialize(id=nil) @id=id end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
306 307 308 |
# File 'lib/ruby-feedbooks.rb', line 306 def id @id end |
Class Method Details
.from_h(h) ⇒ Object
:nodoc:
359 360 361 362 363 364 |
# File 'lib/ruby-feedbooks.rb', line 359 def self.from_h(h) #:nodoc: r=Author.new r.send('id=',h['id']) r.fullname=h['author'] r end |
.recent(limit = nil) ⇒ Object
Recent authors
378 379 380 |
# File 'lib/ruby-feedbooks.rb', line 378 def self.recent(limit=nil) generic_iterate("/authors/recent.xml",limit) end |
.search(txt, limit = nil) ⇒ Object
Search through author catalog
367 368 369 370 |
# File 'lib/ruby-feedbooks.rb', line 367 def self.search(txt,limit=nil) return [] if txt.strip.size==0 generic_iterate("/authors/search.xml?query=#{URI.escape(txt)}",limit) end |
.top(limit = nil) ⇒ Object
Top authors (by download)
373 374 375 |
# File 'lib/ruby-feedbooks.rb', line 373 def self.top(limit=nil) generic_iterate("/authors/top.xml",limit) end |
Instance Method Details
#biography ⇒ Object
354 355 356 357 |
# File 'lib/ruby-feedbooks.rb', line 354 def biography get_attr if @biography==nil @biography end |
#birth ⇒ Object
332 333 334 335 |
# File 'lib/ruby-feedbooks.rb', line 332 def birth get_attr if @birth==nil @birth end |
#books(limit = nil) ⇒ Object
Array of books written by this author
383 384 385 |
# File 'lib/ruby-feedbooks.rb', line 383 def books(limit=nil) FeedBooks::Book.send('generic_iterate',"/author/#{@id}/books.xml",limit) end |
#books_count ⇒ Object
Number of books written by this author
343 344 345 346 |
# File 'lib/ruby-feedbooks.rb', line 343 def books_count get_attr if @books==nil @books end |
#death ⇒ Object
337 338 339 340 |
# File 'lib/ruby-feedbooks.rb', line 337 def death get_attr if @birth==nil @death end |
#downloads_count ⇒ Object
Count of downloaded books from author
349 350 351 352 |
# File 'lib/ruby-feedbooks.rb', line 349 def downloads_count get_attr if @downloads==nil @downloads end |
#firstname ⇒ Object
327 328 329 330 |
# File 'lib/ruby-feedbooks.rb', line 327 def firstname get_attr if @firstname==nil @firstname end |
#fullname ⇒ Object
virtual attribute fullname based on firstname and name
317 318 319 320 |
# File 'lib/ruby-feedbooks.rb', line 317 def fullname get_attr if @name==nil @name+", "+@firstname end |
#fullname=(txt) ⇒ Object
:nodoc:
312 313 314 |
# File 'lib/ruby-feedbooks.rb', line 312 def fullname=(txt) #:nodoc: @name,@firstname=txt.split(",") end |
#name ⇒ Object
322 323 324 325 |
# File 'lib/ruby-feedbooks.rb', line 322 def name get_attr if @name==nil @name end |