Class: Renuo::Cli::Commands::CommitLeaderboardSync

Inherits:
Object
  • Object
show all
Defined in:
lib/renuo/cli/commands/commit_leaderboard_sync.rb

Defined Under Namespace

Classes: SyncError

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#api_secretObject

Returns the value of attribute api_secret.



6
7
8
# File 'lib/renuo/cli/commands/commit_leaderboard_sync.rb', line 6

def api_secret
  @api_secret
end

#leaderboard_api_urlObject

Returns the value of attribute leaderboard_api_url.



6
7
8
# File 'lib/renuo/cli/commands/commit_leaderboard_sync.rb', line 6

def leaderboard_api_url
  @leaderboard_api_url
end

#queue_file_pathObject

Returns the value of attribute queue_file_path.



6
7
8
# File 'lib/renuo/cli/commands/commit_leaderboard_sync.rb', line 6

def queue_file_path
  @queue_file_path
end

Instance Method Details

#run(args, options) ⇒ Object



22
23
24
25
26
27
28
29
30
31
# File 'lib/renuo/cli/commands/commit_leaderboard_sync.rb', line 22

def run(args, options)
  process_args(args)
  print_configuration if options.verbose

  abort(">> Commit queue file does not exist.") unless File.exist?(@queue_file_path)
  abort(">> Invalid API URL.") unless @leaderboard_api_url.match?(URI::DEFAULT_PARSER.make_regexp)

  commits = JSON.parse(File.read(@queue_file_path))
  send_commits(commits)
end