Module: Shikimori::API::V1::Ranobe

Included in:
Shikimori::API::V1
Defined in:
lib/shikimori/api/v1/ranobe.rb

Overview

Methods for the Ranobes API

Instance Method Summary collapse

Instance Method Details

#ranobe(id, headers: nil, **query) ⇒ Hash

Get an ranobe by id

Examples:

Get ranobe with id equal to 1

client = Shikimori::API::Client.new(
  app_name: 'Api Test',
  aceess_token: '****',
  refresh_token: '****'
)
client.v1.ranobe(1) #=> { id: 1, ... }

Parameters:

  • id (#to_s)

    ranobe id

  • headers (Hash) (defaults to: nil)

    Request headers

  • query (Hash)

    Query string parameters for request

Returns:

  • (Hash)

    Hash representing ranobe

See Also:



78
79
80
# File 'lib/shikimori/api/v1/ranobe.rb', line 78

def ranobe(id, headers: nil, **query)
  rest.get base_url.join('ranobe', id.to_s).url, headers: headers, query: query
end

Get an ranobe external links

Examples:

Get related external links for ranobe with id equal 1

client = Shikimori::API::Client.new(
  app_name: 'Api Test',
  aceess_token: '****',
  refresh_token: '****'
)
client.v1.ranobe_external_links(1) #=> [{ id: 1, ... }, { id: nil, ... }]

Parameters:

  • id (#to_s)

    ranobe id

  • headers (Hash) (defaults to: nil)

    Request headers

  • query (Hash)

    Query string parameters for request

Returns:

  • (Array<Hash>)

    Array of hashes representing ranobe’s extenal links

See Also:



179
180
181
# File 'lib/shikimori/api/v1/ranobe.rb', line 179

def ranobe_external_links(id, headers: nil, **query)
  rest.get base_url.join('ranobe', id.to_s, 'external_links').url, headers: headers, query: query
end

#ranobe_franchise(id, headers: nil, **query) ⇒ Hash

Get an ranobe franchise

Examples:

Get ranobe franchise tree for ranobe with id equal to 1

client = Shikimori::API::Client.new(
  app_name: 'Api Test',
  aceess_token: '****',
  refresh_token: '****'
)
client.v1.ranobe_franchise(1) #=> { links: [{ id: 1, ... }], nodes: [{ id: 1, ... }], current_id: 1 }

Parameters:

  • id (#to_s)

    ranobe id

  • headers (Hash) (defaults to: nil)

    Request headers

  • query (Hash)

    Query string parameters for request

Returns:

  • (Hash)

    Hash representing of ranobe’s franchise tree

See Also:



159
160
161
# File 'lib/shikimori/api/v1/ranobe.rb', line 159

def ranobe_franchise(id, headers: nil, **query)
  rest.get base_url.join('ranobe', id.to_s, 'franchise').url, headers: headers, query: query
end

Get an related ranobes

Examples:

Get a related anime, manga and ranobe titles for anime with id equal to 1

client = Shikimori::API::Client.new(
  app_name: 'Api Test',
  aceess_token: '****',
  refresh_token: '****'
)
client.v1.ranobe_related(1)
#=> [{ relation: "...", relation_russian: "...", anime: { id: 3, ... }, ranobe: { id: 1, ... } }]

Parameters:

  • id (#to_s)

    ranobe id

  • headers (Hash) (defaults to: nil)

    Request headers

  • query (Hash)

    Query string parameters for request

Returns:

  • (Array<Hash>)

    Array of hashes representing related ranobes

See Also:



139
140
141
# File 'lib/shikimori/api/v1/ranobe.rb', line 139

def ranobe_related(id, headers: nil, **query)
  rest.get base_url.join('ranobe', id.to_s, 'related').url, headers: headers, query: query
end

#ranobe_roles(id, headers: nil, **query) ⇒ Hash

Get an ranobe roles

Examples:

Get a first ranobe roles

client = Shikimori::API::Client.new(
  app_name: 'Api Test',
  aceess_token: '****',
  refresh_token: '****'
)
client.v1.ranobe_roles(1) #=> { roles: [...], roles_russian: [...], character: {...}, person: {...} }

Parameters:

  • id (#to_s)

    ranobe id

  • headers (Hash) (defaults to: nil)

    Request headers

  • query (Hash)

    Query string parameters for request

Returns:

  • (Hash)

    Hash representing ranobe roles

See Also:



98
99
100
# File 'lib/shikimori/api/v1/ranobe.rb', line 98

def ranobe_roles(id, headers: nil, **query)
  rest.get base_url.join('ranobe', id.to_s, 'roles').url, headers: headers, query: query
end

#ranobe_similar(id, headers: nil, **query) ⇒ Array<Hash>

Get an ranobe similar

Examples:

Get a similar ranobe titles for ranobe with id equal to 1

client = Shikimori::API::Client.new(
  app_name: 'Api Test',
  aceess_token: '****',
  refresh_token: '****'
)
client.v1.ranobe_similar(1) #=> { id: 2, ... }

Parameters:

  • id (#to_s)

    ranobe id

  • headers (Hash) (defaults to: nil)

    Request headers

  • query (Hash)

    Query string parameters for request

Returns:

  • (Array<Hash>)

    Array of hashes representing similar ranobes

See Also:



118
119
120
# File 'lib/shikimori/api/v1/ranobe.rb', line 118

def ranobe_similar(id, headers: nil, **query)
  rest.get base_url.join('ranobe', id.to_s, 'similar').url, headers: headers, query: query
end

#ranobe_topics(id, headers: nil, **query) ⇒ Array<Hash>

Get an ranobe topics

Examples:

Get topics for ranobe with id equal 1

client = Shikimori::API::Client.new(
  app_name: 'Api Test',
  aceess_token: '****',
  refresh_token: '****'
)
client.v1.ranobe_topics(1) #=> [{ id: 1, ... }]

Parameters:

  • id (#to_s)

    ranobe id

  • headers (Hash) (defaults to: nil)

    Request headers

  • query (Hash)

    Query string parameters for request

Options Hash (**query):

  • :page (Integer)

    Number of page. Must be between 1 and 100000

  • :limit (Integer)

    Number of titles per page. Must be a lower or equal that 50

Returns:

  • (Array<Hash>)

    Array of hashes representing ranobe’s topics

See Also:



200
201
202
# File 'lib/shikimori/api/v1/ranobe.rb', line 200

def ranobe_topics(id, headers: nil, **query)
  rest.get base_url.join('ranobe', id.to_s, 'topics').url, headers: headers, query: query
end

#ranobes(headers: nil, **query) ⇒ Array<Hash>

Get list of ranobe titles

Examples:

Get 20 ranobe titles on second page

client = Shikimori::API::Client.new(
  app_name: 'Api Test',
  aceess_token: '****',
  refresh_token: '****'
)
client.v1.ranobes(page: 2, limit: 20) #=> [{ id: 1, ... }, { id: 2, ... }, ...]

Get top 50 ongoing ranobe titles

client = Shikimori::API::Client.new(
  app_name: 'Api Test',
  aceess_token: '****',
  refresh_token: '****'
)
client.v1.ranobes(limit: 50, status: 'ongoing', order: 'ranked') #=> [{ id: 1, ... }, { id: 2, ... }, ...]

Get 10 random ranobe titles released in the 90s

client = Shikimori::API::Client.new(
  app_name: 'Api Test',
  aceess_token: '****',
  refresh_token: '****'
)
client.v1.ranobes(limit: 10, order: 'random', season: '199x') #=> [{ id: 1, ... }, { id: 2, ... }, ...]

Parameters:

  • headers (Hash) (defaults to: nil)

    Request headers

  • query (Hash)

    Filters and pagination for ranobes

Options Hash (**query):

  • :page (Integer)

    Number of page. Must be between 1 and 100000

  • :limit (Integer)

    Number of titles per page. Must be a lower or equal that 50

  • :order ("id", "id_desc", "ranked", "chapters", "kind", "popularity", "name", "aired_on", "volumes", "status", "random", "ranked_random", "ranked_shiki", "created_at", "created_at_desc")

    Sorting type.

  • :status ("anons", "ongoing", "released", "paused", "discontinued")

    Ranobe title status

  • :season (String)

    Ranobe season. Examples: “summer_2017”, “2016”, “2014_2016”, “199x”

  • :score (Integer)

    Minimal ranobe score

  • :genre (String)

    List of genre ids separated by comma

  • :publisher (String)

    List of publisher ids separated by comma

  • :franchise (String)

    List of franchises separated by comma

  • :censored (TrueClass, FalseClass)

    Set to false to allow hentai, yaoi and yuri

  • :mylist ("planned", "watching", "rewatching", "completed", "on_hold", "dropped")

    Status of anime in current user list

  • :ids (String)

    List of anime ids separated by comma

  • :exclude_ids (String)

    List of anime ids separated by comma

  • :search (String)

    Search phrase to filter ranobes by name

Returns:

  • (Array<Hash>)

    Array of hashes representing ranobes

See Also:



58
59
60
# File 'lib/shikimori/api/v1/ranobe.rb', line 58

def ranobes(headers: nil, **query)
  rest.get base_url.join('ranobe').url, headers: headers, query: query
end