Module: TimesBooks::List

Included in:
Client
Defined in:
lib/times_books/list.rb

Instance Method Summary collapse

Instance Method Details

#getListByName(name) ⇒ Object

gets individual list by name, results more recent published



5
6
7
8
9
10
11
12
# File 'lib/times_books/list.rb', line 5

def getListByName(name)
  url = "https://api.nytimes.com/svc/books/v3/lists.json"
  params =  { 
    list: name 
  }
  
  self.request(url, params)
end

#getListsObject

gets a summary of all lists (no book results)



15
16
17
18
19
# File 'lib/times_books/list.rb', line 15

def getLists()
  url = "https://api.nytimes.com/svc/books/v3/lists/names.json"
  params =  {}
  self.request(url, params)
end

#getListsByDate(date) ⇒ Object

returns complete set of published lists, including book results, for provided date



34
35
36
37
38
39
40
# File 'lib/times_books/list.rb', line 34

def getListsByDate(date)
  url = "https://api.nytimes.com/svc/books/v3/lists/overview.json"
  params = {
    published_date: date
  }
  self.request(url, params)
end

#searchLists(author = '', title = '', publisher = '') ⇒ Object

search for a list that contains a book with a certain author, title, or publisher



22
23
24
25
26
27
28
29
30
31
# File 'lib/times_books/list.rb', line 22

def searchLists(author = '', title = '', publisher = '')
  url = "https://api.nytimes.com/svc/books/v3/lists/best-sellers/history.json"
  params = {
    author: author,
    title: title,
    publisher: publisher
  }
  
  self.request(url, params)
end

#searchReviews(isbn = '', title = '', author = '') ⇒ Object

search for a review by book title, author, or isbn



43
44
45
46
47
48
49
50
51
# File 'lib/times_books/list.rb', line 43

def searchReviews(isbn = '', title = '', author = '')
  url = "https://api.nytimes.com/svc/books/v3/reviews.json"
  params = {
    author: author,
    title: title,
    isbn: isbn
  }
  self.request(url, params)
end