Module: OneApiSdk::Client::Chapters

Included in:
OneApiSdk::Client
Defined in:
lib/one_api_sdk/chapters.rb

Instance Method Summary collapse

Instance Method Details

#chapter(id, query_params = "") ⇒ Hash

Request one specific book chapter

Parameters:

  • id (String)

    the unique id of the chapter

  • options (Array<String>)

    The query parameters you want passed into the request.

Returns:

  • (Hash)

    The returned chapter object



22
23
24
25
# File 'lib/one_api_sdk/chapters.rb', line 22

def chapter(id,query_params="")
  response = call_with_token("#{Constants::CHAPTER_BASE_PATH}/#{id}#{query_params}")
  JSON.parse(response.body)
end

#chapters(query_params = "") ⇒ Array<Hash>

List all book chapters

Parameters:

  • query_params (String) (defaults to: "")

    the query parameters you want to include in your search IE: “?sort=name:asc”

Returns:

  • (Array<Hash>)

    An array of chapters



13
14
15
16
# File 'lib/one_api_sdk/chapters.rb', line 13

def chapters(query_params="")
  response = call_with_token("#{Constants::CHAPTER_BASE_PATH}#{query_params}")
  JSON.parse(response.body)
end