Module: Shikimori::API::V1::Clubs

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

Overview

Methods for the Clubs API

Instance Method Summary collapse

Instance Method Details

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

Get a club by id

Examples:

Get a club with id equal to 1

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

Parameters:

  • id (#to_s)

    Club id

  • headers (Hash) (defaults to: nil)

    Request headers

  • query (Hash)

    Query string parameters for request

Returns:

  • (Hash)

    Hash representing club

Raises:

See Also:



50
51
52
# File 'lib/shikimori/api/v1/clubs.rb', line 50

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

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

Get list of club’s animes

Examples:

First 20 club animes

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

Parameters:

  • id (#to_s)

    Club’s 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 clubs per page. Must be a lower or equal that 20

Returns:

  • (Array<Hash>)

    Array of hashes representing club animes

Raises:

See Also:



105
106
107
# File 'lib/shikimori/api/v1/clubs.rb', line 105

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

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

Get list of club’s characters

Examples:

First 20 club characters

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

Parameters:

  • id (#to_s)

    Club’s 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 clubs per page. Must be a lower or equal that 20

Returns:

  • (Array<Hash>)

    Array of hashes representing club characters

Raises:

See Also:



177
178
179
# File 'lib/shikimori/api/v1/clubs.rb', line 177

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

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

Get list of club’s clubs

Examples:

First 20 club clubs

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

Parameters:

  • id (#to_s)

    Club’s 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 clubs per page. Must be a lower or equal that 20

Returns:

  • (Array<Hash>)

    Array of hashes representing club clubs

Raises:

See Also:



225
226
227
# File 'lib/shikimori/api/v1/clubs.rb', line 225

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

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

Get list of club’s collections

Examples:

First 20 club collections

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

Parameters:

  • id (#to_s)

    Club’s 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 clubs per page. Must be a lower or equal that 20

Returns:

  • (Array<Hash>)

    Array of hashes representing club collections

Raises:

See Also:



201
202
203
# File 'lib/shikimori/api/v1/clubs.rb', line 201

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

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

Get list of club’s images

Examples:

First 20 club images

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

Parameters:

  • id (#to_s)

    Club’s 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 clubs per page. Must be a lower or equal that 100

Returns:

  • (Array<Hash>)

    Array of hashes representing club images

Raises:

See Also:



273
274
275
# File 'lib/shikimori/api/v1/clubs.rb', line 273

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

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

Get list of club’s mangas

Examples:

First 20 club mangas

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

Parameters:

  • id (#to_s)

    Club’s 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 clubs per page. Must be a lower or equal that 20

Returns:

  • (Array<Hash>)

    Array of hashes representing club mangas

Raises:

See Also:



129
130
131
# File 'lib/shikimori/api/v1/clubs.rb', line 129

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

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

Get list of club’s members

Examples:

First 20 club members

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

Parameters:

  • id (#to_s)

    Club’s 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 clubs per page. Must be a lower or equal that 20

Returns:

  • (Array<Hash>)

    Array of hashes representing club members

Raises:

See Also:



249
250
251
# File 'lib/shikimori/api/v1/clubs.rb', line 249

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

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

Get list of club’s ranobe

Examples:

First 20 club ranobe

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

Parameters:

  • id (#to_s)

    Club’s 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 clubs per page. Must be a lower or equal that 20

Returns:

  • (Array<Hash>)

    Array of hashes representing club ranobe

Raises:

See Also:



153
154
155
# File 'lib/shikimori/api/v1/clubs.rb', line 153

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

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

Get list of clubs

Examples:

Search a 20 clubs with name equal to ‘yuri’

client = Shikimori::API::Client.new(
  app_name: 'Api Test',
  aceess_token: '****',
  refresh_token: '****'
)
client.v1.clubs(search: 'yuri')

Parameters:

  • 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 clubs per page. Must be a lower or equal that 30

  • :search (String)

    Filter by name of club

Returns:

  • (Array<Hash>)

    Array of hashes representing clubs

See Also:



28
29
30
# File 'lib/shikimori/api/v1/clubs.rb', line 28

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

#join_club(id, headers: nil, **query) ⇒ Boolean

Join to club. Requires ‘clubs` oauth scope

Examples:

Join to club with id equal to 1

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

Parameters:

  • id (String)

    Club’s id

  • headers (Hash) (defaults to: nil)

    Request headers

  • query (Hash)

    Query string parameters for request

Returns:

  • (Boolean)

    True if join successful, error otherwise.

Raises:

See Also:



296
297
298
299
300
# File 'lib/shikimori/api/v1/clubs.rb', line 296

def join_club(id, headers: nil, **query)
  rest.post base_url.join('clubs', id.to_s, 'join').url, {}, headers: headers, query: query

  true
end

#leave_club(id, headers: nil, **query) ⇒ Boolean

Leave from club. Requires ‘clubs` oauth scope

Examples:

Leave from club with id equal to 1

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

Parameters:

  • id (String)

    Club’s id

  • headers (Hash) (defaults to: nil)

    Request headers

  • query (Hash)

    Query string parameters for request

Returns:

  • (Boolean)

    True if leave successful, error otherwise.

Raises:

See Also:



321
322
323
324
325
# File 'lib/shikimori/api/v1/clubs.rb', line 321

def leave_club(id, headers: nil, **query)
  rest.post base_url.join('clubs', id.to_s, 'leave').url, {}, headers: headers, query: query

  true
end

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

Update Club. Requires ‘clubs` oauth scope

Examples:

Update club’s name and topic policy

client = Shikimori::API::Client.new(
  app_name: 'Api Test',
  aceess_token: '****',
  refresh_token: '****'
)
client.v1.update_club(1, { name: "Best of the best", topic_policy: "admins" }) #=> { id: 1, ... }

Parameters:

  • id (#to_s)

    Club id

  • club (Hash)

    Club data for updating

  • headers (Hash) (defaults to: nil)

    Request headers

  • query (Hash)

    Query string parameters for request

Options Hash (club):

  • :name (String)

    Club’s name

  • :description (String)

    Club’s description

  • :display_images ('true', 'false', 1, 0)

    Display club’s images?

  • :comment_policy ("free", "members", "admins")

    Club’s comments policy

  • :topic_policy ("members", "admins")

    Club’s topics policy

  • :image_upload_policy ("members", "admins")

    Club’s uploading images policy

Returns:

  • (Hash)

    Hash representing updated club

Raises:

See Also:



81
82
83
# File 'lib/shikimori/api/v1/clubs.rb', line 81

def update_club(id, club, headers: nil, **query)
  rest.put base_url.join('clubs', id.to_s).url, { club: club }, headers: headers, query: query
end