Class: CardDB::Resources::Rules

Inherits:
Base
  • Object
show all
Defined in:
lib/carddb/resources/rules.rb

Overview

Rules resource for listing game rules and deck formats.

Instance Attribute Summary

Attributes inherited from Base

#client, #config, #connection

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from CardDB::Resources::Base

Instance Method Details

#datasets(publisher_slug: nil, game_key: nil, search: nil, first: nil, after: nil) ⇒ Collection<Dataset>

List rule-related datasets for a game.

Parameters:

  • publisher_slug (String, nil) (defaults to: nil)

    Publisher slug (uses default if not provided)

  • game_key (String, nil) (defaults to: nil)

    Game key (uses default if not provided)

  • search (String, nil) (defaults to: nil)

    Search by dataset name

  • first (Integer, nil) (defaults to: nil)

    Maximum number of results

  • after (String, nil) (defaults to: nil)

    Cursor for pagination

Returns:



15
16
17
18
19
20
21
22
23
24
# File 'lib/carddb/resources/rules.rb', line 15

def datasets(publisher_slug: nil, game_key: nil, search: nil, first: nil, after: nil)
  client.datasets.search(
    publisher_slug: publisher_slug,
    game_key: game_key,
    search: search,
    purpose: 'RULES',
    first: first,
    after: after
  )
end

#formats(dataset_key: 'formats', **options, &block) ⇒ Collection<Record>

List deck/game formats from the game’s formats dataset.

Parameters:

  • dataset_key (String) (defaults to: 'formats')

    Formats dataset key (defaults to “formats”)

Returns:



38
39
40
# File 'lib/carddb/resources/rules.rb', line 38

def formats(dataset_key: 'formats', **options, &block)
  search_records(dataset_key: dataset_key, **options, &block)
end

#list(dataset_key: 'rules', **options, &block) ⇒ Collection<Record>

List rules from the game’s rules dataset.

Parameters:

  • dataset_key (String) (defaults to: 'rules')

    Rules dataset key (defaults to “rules”)

Returns:



30
31
32
# File 'lib/carddb/resources/rules.rb', line 30

def list(dataset_key: 'rules', **options, &block)
  search_records(dataset_key: dataset_key, **options, &block)
end