Class: Harkness::StoryResource

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

Overview

The story 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(story_id:) ⇒ Harkness::CharacterDataWrapper

Get a list of characters for a particular story.

Examples:

client.stories.characters(story_id: 1234)

Parameters:

  • story_id (Integer)

    the ID of the story.

Returns:



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

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

#comics(story_id:) ⇒ Harkness::ComicDataWrapper

Get a list of comics for a particular story.

Examples:

client.stories.comics(story_id: 1234)

Parameters:

  • story_id (Integer)

    the ID of the story.

Returns:



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

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

#creators(story_id:) ⇒ Harkness::CreatorDataWrapper

Get a list of creators for a particular story.

Examples:

client.stories.creators(story_id: 1234)

Parameters:

  • story_id (Integer)

    the ID of the story.

Returns:



68
69
70
# File 'lib/harkness/resources/story.rb', line 68

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

#events(story_id:) ⇒ Harkness::EventDataWrapper

Get a list of events for a particular story.

Examples:

client.stories.events(story_id: 1234)

Parameters:

  • story_id (Integer)

    the ID of the story.

Returns:



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

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

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

Get a list of stories.

Examples:

client.stories.list
client.stories.list(creators: "1234", limit: 10, orderBy: "id")

Parameters:

Returns:



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

def list(**params)
  StoryDataWrapper.from_json(get_request("stories", params: params).body)
end

#retrieve(story_id:) ⇒ Harkness::StoryDataWrapper

Get a single story.

Examples:

client.stories.retrieve(story_id: 1234)

Parameters:

  • story_id (Integer)

    the ID of the story.

Returns:



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

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

#series(story_id:) ⇒ Harkness::SeriesDataWrapper

Get a list of series for a particular story.

Examples:

client.stories.series(story_id: 1234)

Parameters:

  • story_id (Integer)

    the ID of the story.

Returns:



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

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