Module: Shikimori::API::V1::People

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

Overview

Methods for the People API

Instance Method Summary collapse

Instance Method Details

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

Get list of People

Examples:

Search a Hayao Miyazaki at mangakas list

client = Shikimori::API::Client.new(
  app_name: 'Api Test',
  aceess_token: '****',
  refresh_token: '****'
)
client.v1.people(search: 'Hayao Miyazaki', kind: 'mangaka')

Parameters:

  • headers (Hash) (defaults to: nil)

    Request headers

  • query (Hash)

    Query string parameters for request

Options Hash (**query):

  • :search (String)

    Filter by person name

  • :kind ('seyu', 'mangaka', 'producer')

    Filter by person type

Returns:

  • (Array<Hash>)

    Array of hashes representing people

See Also:



27
28
29
# File 'lib/shikimori/api/v1/people.rb', line 27

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

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

Get an person by id

Examples:

Get a person with id equal to 1

client = Shikimori::API::Client.new(
  app_name: 'Api Test',
  aceess_token: '****',
  refresh_token: '****'
)
client.v1.person(1)

Parameters:

  • id (String, Integer)

    Person id

  • headers (Hash) (defaults to: nil)

    Request headers

  • query (Hash)

    Query string parameters for request

Returns:

  • (Hash)

    Hash representing person

See Also:



47
48
49
# File 'lib/shikimori/api/v1/people.rb', line 47

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