Class: RestBooks::Authors
- Inherits:
-
Object
- Object
- RestBooks::Authors
- Includes:
- Api
- Defined in:
- lib/restbooks/authors.rb
Constant Summary
Constants included from Api
RestBooks::Api::AUTHOR_PARAMETERS, RestBooks::Api::BOOK_PARAMETERS, RestBooks::Api::LIST_PARAMETERS, RestBooks::Api::ORDERED_AUTHOR_PARAMETERS, RestBooks::Api::ORDERED_BOOK_PARAMETERS, RestBooks::Api::RANGED_AUTHOR_PARAMETERS, RestBooks::Api::RANGED_BOOK_PARAMETERS
Instance Method Summary collapse
-
#all(options = {}) ⇒ Object
Endpoint: /authors Formats: Atom Description: List all authors (20 items) Parameters: * letter: display the authors with …
-
#books(author_id, options = {}) ⇒ Object
Endpoint: /author/:id/books Formats: Atom Description: List all books for an author (id) Parameters: Same as /books.
-
#recent(options = {}) ⇒ Object
Endpoint: /authors/recent Formats: Atom Description: List recent authors (20 items) Parameters: * letter: display the authors with …
-
#recent_books(author_id, options = {}) ⇒ Object
Endpoint: /author/:id/books/recent Formats: Atom, RSS Description: List recent books for an author (id) Parameters: Same as /books/recent.
-
#top(options = {}) ⇒ Object
Endpoint: /authors/top Formats: Atom Description: List top authors (20 items) Parameters: * letter: display the authors with …
-
#top_books(author_id, options = {}) ⇒ Object
Endpoint: /author/:id/books/top Formats: Atom Description: List top books for an author (id) Parameters: Same as /books/top.
Instance Method Details
#all(options = {}) ⇒ Object
Endpoint: /authors
Formats: Atom
Description: List all authors (20 items)
Parameters:
* letter: display the authors with ... as the first letter of their name
* born: authors born in ...
* death: author who dies in ...
* lang: language of the author
* order: normally from A to Z, use desc to reverse order
37 38 39 40 |
# File 'lib/restbooks/authors.rb', line 37 def all( ={} ) create_url( "/authors", , ORDERED_AUTHOR_PARAMETERS ) return do_request( :author ) end |
#books(author_id, options = {}) ⇒ Object
Endpoint: /author/:id/books
Formats: Atom
Description: List all books for an author (id)
Parameters: Same as /books
73 74 75 76 77 |
# File 'lib/restbooks/authors.rb', line 73 def books( , ={} ) = .id if .kind_of? RestBooks::Models::Author create_url( "/author/#{}/books", , ORDERED_BOOK_PARAMETERS ) return do_request( :book ) end |
#recent(options = {}) ⇒ Object
Endpoint: /authors/recent
Formats: Atom
Description: List recent authors (20 items)
Parameters:
* letter: display the authors with ... as the first letter of their name
* born: authors born in ...
* death: author who dies in ...
* lang: language of the author
64 65 66 67 |
# File 'lib/restbooks/authors.rb', line 64 def recent( ={} ) create_url( "/authors/recent", , AUTHOR_PARAMETERS ) return do_request( :author ) end |
#recent_books(author_id, options = {}) ⇒ Object
Endpoint: /author/:id/books/recent
Formats: Atom, RSS
Description: List recent books for an author (id)
Parameters: Same as /books/recent
93 94 95 96 97 |
# File 'lib/restbooks/authors.rb', line 93 def recent_books( , ={} ) = .id if .kind_of? RestBooks::Models::Author create_url( "/author/#{}/books/recent", , BOOK_PARAMETERS ) return do_request( :book ) end |
#top(options = {}) ⇒ Object
Endpoint: /authors/top
Formats: Atom
Description: List top authors (20 items)
Parameters:
* letter: display the authors with ... as the first letter of their name
* born: authors born in ...
* death: author who dies in ...
* lang: language of the author
* range: normally overall, week will display the most popular for the previous week and month for the last 4 weeks
51 52 53 54 |
# File 'lib/restbooks/authors.rb', line 51 def top( ={} ) create_url( "/authors/top", , RANGED_AUTHOR_PARAMETERS ) return do_request( :author ) end |
#top_books(author_id, options = {}) ⇒ Object
Endpoint: /author/:id/books/top
Formats: Atom
Description: List top books for an author (id)
Parameters: Same as /books/top
83 84 85 86 87 |
# File 'lib/restbooks/authors.rb', line 83 def top_books( , ={} ) = .id if .kind_of? RestBooks::Models::Author create_url( "/author/#{}/books/top", , RANGED_BOOK_PARAMETERS ) return do_request( :book ) end |