Class: ItchRewards::CLI::Commands::Rewards::List

Inherits:
Dry::CLI::Command
  • Object
show all
Includes:
AuthOptions, Helper
Defined in:
lib/itch_rewards/cli.rb

Instance Method Summary collapse

Methods included from Helper

#authenticated_client, #authenticated_client!, #cli, #color, #objects_to_table, #render_table, #show_rewards

Methods included from AuthOptions

included

Instance Method Details

#call(**options) ⇒ Object



172
173
174
175
176
177
178
179
180
181
182
# File 'lib/itch_rewards/cli.rb', line 172

def call(**options)
  if options[:id].nil? && options[:name].nil?
    cli.error "Game ID or game name argument is required"
    exit 1
  end

  client = authenticated_client!(options)
  game = options[:id] ? client.game(options[:id]) : client.game(name: options[:name])

  show_rewards(game)
end