Module: NBA::CumeStatsTeamGames::PathBuilder Private

Defined in:
lib/nba/cume_stats_team_games.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Builds API path from options

Class Method Summary collapse

Class Method Details

.build(opts) ⇒ String

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Builds the complete API path from options

Parameters:

  • opts (Hash)

    the options hash

Returns:

  • (String)

    the complete API path



57
58
59
# File 'lib/nba/cume_stats_team_games.rb', line 57

def self.build(opts)
  "cumestatsteamgames?#{Utils.build_query(**build_params(opts))}"
end

.build_params(opts) ⇒ Hash

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Builds all parameters from options

Parameters:

  • opts (Hash)

    the options hash

Returns:

  • (Hash)

    the merged parameters



65
66
67
# File 'lib/nba/cume_stats_team_games.rb', line 65

def self.build_params(opts)
  required_params(opts).merge(optional_params(opts))
end

.optional_params(opts) ⇒ Hash

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Builds optional parameters from options

Parameters:

  • opts (Hash)

    the options hash

Returns:

  • (Hash)

    the optional parameters



86
87
88
89
90
91
92
# File 'lib/nba/cume_stats_team_games.rb', line 86

def self.optional_params(opts)
  {
    Location: opts.fetch(:location), Outcome: opts.fetch(:outcome), SeasonID: opts.fetch(:season_id),
    VsConference: opts.fetch(:vs_conference), VsDivision: opts.fetch(:vs_division),
    VsTeamID: Utils.extract_id(opts.fetch(:vs_team))
  }
end

.required_params(opts) ⇒ Hash

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Builds required parameters from options

Parameters:

  • opts (Hash)

    the options hash

Returns:

  • (Hash)

    the required parameters



73
74
75
76
77
78
79
80
# File 'lib/nba/cume_stats_team_games.rb', line 73

def self.required_params(opts)
  {
    TeamID: Utils.extract_id(opts.fetch(:team)),
    LeagueID: Utils.extract_league_id(opts.fetch(:league)),
    Season: Utils.format_season(opts.fetch(:season)),
    SeasonType: opts.fetch(:season_type)
  }
end