Class: Harkness::CharacterResource

Inherits:
Resource
  • Object
show all
Defined in:
lib/harkness/resources/character.rb

Overview

The character resource.

Instance Attribute Summary

Attributes inherited from Resource

#client

Instance Method Summary collapse

Methods inherited from Resource

#initialize

Constructor Details

This class inherits a constructor from Harkness::Resource

Instance Method Details

#comics(character_id:) ⇒ Harkness::ComicDataWrapper

Get a list of comics for a particular character.

Examples:

client.characters.comics(character_id: 1234)

Parameters:

  • character_id (Integer)

    the ID of the character.

Returns:



32
33
34
# File 'lib/harkness/resources/character.rb', line 32

def comics(character_id:)
  ComicDataWrapper.from_json(get_request("characters/#{character_id}/comics").body)
end

#events(character_id:) ⇒ Harkness::EventDataWrapper

Get a list of events for a particular character.

Examples:

client.characters.events(character_id: 1234)

Parameters:

  • character_id (Integer)

    the ID of the character.

Returns:



41
42
43
# File 'lib/harkness/resources/character.rb', line 41

def events(character_id:)
  EventDataWrapper.from_json(get_request("characters/#{character_id}/events").body)
end

#list(**params) ⇒ Harkness::CharacterDataWrapper

Get a list of characters.

Examples:

client.characters.list
client.characters.list(nameStartsWith: "Ant-", limit: 10, orderBy: "-modified")

Parameters:

Returns:



14
15
16
# File 'lib/harkness/resources/character.rb', line 14

def list(**params)
  CharacterDataWrapper.from_json(get_request("characters", params: params).body)
end

#retrieve(character_id:) ⇒ Harkness::CharacterDataWrapper

Get a single character.

Examples:

client.characters.retrieve(character_id: 1234)

Parameters:

  • character_id (Integer)

    the ID of the character.

Returns:



23
24
25
# File 'lib/harkness/resources/character.rb', line 23

def retrieve(character_id:)
  CharacterDataWrapper.from_json(get_request("characters/#{character_id}").body)
end

#series(character_id:) ⇒ Harkness::SeriesDataWrapper

Get a list of series for a particular character.

Examples:

client.characters.series(character_id: 1234)

Parameters:

  • character_id (Integer)

    the ID of the character.

Returns:



50
51
52
# File 'lib/harkness/resources/character.rb', line 50

def series(character_id:)
  SeriesDataWrapper.from_json(get_request("characters/#{character_id}/series").body)
end

#stories(character_id:) ⇒ Harkness::StoryDataWrapper

Get a list of stories for a particular character.

Examples:

client.stories.characters(character_id: 1234)

Parameters:

  • character_id (Integer)

    the ID of the character.

Returns:



59
60
61
# File 'lib/harkness/resources/character.rb', line 59

def stories(character_id:)
  StoryDataWrapper.from_json(get_request("characters/#{character_id}/stories").body)
end