Class: Shelfari::API
- Inherits:
-
Object
- Object
- Shelfari::API
- Defined in:
- lib/shelfari/api.rb
Instance Method Summary collapse
-
#initialize ⇒ API
constructor
A new instance of API.
- #request(uri) ⇒ Object
- #response(response) ⇒ Object
Methods included from Helper
Methods included from User
#followers, #now_reading, #user
Methods included from Book
#book_by_id, #book_by_isbn, #search
Constructor Details
#initialize ⇒ API
Returns a new instance of API.
11 12 13 |
# File 'lib/shelfari/api.rb', line 11 def initialize @agent = Mechanize.new end |
Instance Method Details
#request(uri) ⇒ Object
15 16 17 |
# File 'lib/shelfari/api.rb', line 15 def request(uri) @agent.get('http://www.shelfari.com'+uri) end |
#response(response) ⇒ Object
19 20 21 |
# File 'lib/shelfari/api.rb', line 19 def response(response) JSON.generate(response) end |