Class: Precious::API::V2::Books

Inherits:
Base
  • Object
show all
Defined in:
lib/precious/books.rb

Constant Summary

Constants inherited from Base

Precious::API::V2::Base::API_ENDPOINT

Instance Attribute Summary

Attributes inherited from Base

#api_key

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Precious::API::V2::Base

Instance Method Details

#get_book(id:) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
# File 'lib/precious/books.rb', line 19

def get_book(id:)
  params = {
    _id: id
  }

  request(
    http_method: :get,
    endpoint: "book",
    params: params
  )
end

#get_book_chapters(id:, limit: 0, page: 0, offset: 0) ⇒ Object

GET the-one-api.dev/v2/book/id/chapters



32
33
34
35
36
37
38
39
40
# File 'lib/precious/books.rb', line 32

def get_book_chapters(id:, limit: 0, page: 0, offset: 0)
  params = set_params(limit: limit, page: page, offset: offset)

  request(
    http_method: :get,
    endpoint: "book/#{id}/chapter",
    params: params
  )
end

#get_books(limit: 0, page: 0, offset: 0) ⇒ Object



8
9
10
11
12
13
14
15
16
# File 'lib/precious/books.rb', line 8

def get_books(limit: 0, page: 0, offset: 0)
  params = set_params(limit: limit, page: page, offset: offset)

  request(
    http_method: :get,
    endpoint: "book",
    params: params
  )
end