Module: Shikimori::API::V1::Dialogs

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

Overview

Methods for the Dialogs API

Instance Method Summary collapse

Instance Method Details

#delete_dialog(username, headers: nil, **query) ⇒ Boolean

Delete Dialog. Requires ‘messages` oauth scope

Examples:

Delete dialog with id equal to 1

client = Shikimori::API::Client.new(
  app_name: 'Api Test',
  aceess_token: '****',
  refresh_token: '****'
)
client.v1.delete_dialog('user_12') #=> true

Parameters:

  • username (#to_s)

    Dialog’s username

  • headers (Hash) (defaults to: nil)

    Request headers

  • query (Hash)

    Query string parameters for request

Returns:

  • (Boolean)

    True if deletion successful, false otherwise.

See Also:



72
73
74
# File 'lib/shikimori/api/v1/dialogs.rb', line 72

def delete_dialog(username, headers: nil, **query)
  rest.delete base_url.join('dialogs', username.to_s).url, headers: headers, query: query
end

#dialog(username, headers: nil, **query) ⇒ Hash

Get a dialog by username. Requires ‘messages` oauth scope

Examples:

Get dialog with username equal to 1

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

Parameters:

  • username (#to_s)

    Dialog’s username

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

Returns:

  • (Hash)

    Hash representing dialog

See Also:



51
52
53
# File 'lib/shikimori/api/v1/dialogs.rb', line 51

def dialog(username, headers: nil, **query)
  rest.get base_url.join('dialogs', username.to_s).url, headers: headers, query: query
end

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

Get list of Dialogs. Requires ‘messages` oauth scope

Examples:

Get list of dialogs

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

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 dialogs per page. Must be a lower or equal that 20

Returns:

  • (Array<Hash>)

    Array of hashes representing dialogs

See Also:



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

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