class BooksNow::Books
Attributes
book_response[R]
Public Instance Methods
get_csv()
click to toggle source
# File lib/books_now.rb, line 18 def get_csv CSV.open("books.csv", "wb") {|csv| @book_response.to_a.each {|token| csv << token} } end
look_for(isbn)
click to toggle source
# File lib/books_now.rb, line 8 def look_for(isbn) @book_response = RestClient::Request.new( :method => :get, :url => 'https://openlibrary.org/api/books?bibkeys=ISBN:'+isbn, :verify_ssl => false ).execute @book_response = @book_response.split('=')[1].split(';')[0] @book_response = JSON.parse(@book_response) return @book_response.to_s end