Module: OneApiSdk::Client::Characters

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

Instance Method Summary collapse

Instance Method Details

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

Request one specific character

Parameters:

  • id (String)

    the unique id of the character

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

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

Returns:

  • (Hash)

    The returned character object



23
24
25
26
# File 'lib/one_api_sdk/characters.rb', line 23

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

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

Request all movie quotes for one specific character (only working for the LotR trilogy)

Parameters:

  • id (String)

    the unique id of the character

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

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

Returns:

  • (Hash)

    The returned character quotes object



33
34
35
36
# File 'lib/one_api_sdk/characters.rb', line 33

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

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

List of characters including metadata like name, gender, realm, race and more

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 characters



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

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