Class: Shelfari::API

Inherits:
Object
  • Object
show all
Includes:
Book, Helper, User
Defined in:
lib/shelfari/api.rb

Instance Method Summary collapse

Methods included from Helper

#extract_books

Methods included from User

#followers, #now_reading, #user

Methods included from Book

#book_by_id, #book_by_isbn, #search

Constructor Details

#initializeAPI

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