Class: Harkness::ComicResource

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

Overview

The comic 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

#characters(comic_id:) ⇒ Harkness::CharacterDataWrapper

Get a list of characters for a particular comic.

Examples:

client.comics.characters(comic_id: 1234)

Parameters:

  • comic_id (Integer)

    the ID of the comic.

Returns:



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

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

#creators(comic_id:) ⇒ Harkness::CreatorDataWrapper

Get a list of creators for a particular comic.

Examples:

client.comics.creators(comic_id: 1234)

Parameters:

  • comic_id (Integer)

    the ID of the comic.

Returns:



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

def creators(comic_id:)
  CreatorDataWrapper.from_json(get_request("comics/#{comic_id}/creators").body)
end

#events(comic_id:) ⇒ Harkness::EventDataWrapper

Get a list of events for a particular comic.

Examples:

client.comics.events(comic_id: 1234)

Parameters:

  • comic_id (Integer)

    the ID of the comic.

Returns:



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

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

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

Get a list of comics.

Examples:

client.comics.list
client.comics.list(titleStartsWith: "Spider", limit: 10, orderBy: "issueNumber")

Parameters:

Returns:



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

def list(**params)
  ComicDataWrapper.from_json(get_request("comics", params: params).body)
end

#retrieve(comic_id:) ⇒ Harkness::ComicDataWrapper

Get a single comic.

Examples:

client.comics.retrieve(comic_id: 1234)

Parameters:

  • comic_id (Integer)

    the ID of the comic.

Returns:



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

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

#stories(comic_id:) ⇒ Harkness::StoryDataWrapper

Get a list of stories for a particular comic.

Examples:

client.comics.stories(comic_id: 1234)

Parameters:

  • comic_id (Integer)

    the ID of the comic.

Returns:



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

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