Module: NBA::CumeStatsPlayerGames::PathBuilder Private
- Defined in:
- lib/nba/cume_stats_player_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
-
.base_path(opts) ⇒ String
private
Builds the base API path from options.
-
.build(opts) ⇒ String
private
Builds the complete API path from options.
-
.optional_params(opts) ⇒ String
private
Builds optional parameters string from options.
Class Method Details
.base_path(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 base API path from options
75 76 77 78 79 80 81 82 |
# File 'lib/nba/cume_stats_player_games.rb', line 75 def self.base_path(opts) player_id = Utils.extract_id(opts.fetch(:player)) league_id = Utils.extract_league_id(opts.fetch(:league)) season_str = Utils.format_season(opts.fetch(:season)) "cumestatsplayergames?PlayerID=#{player_id}&LeagueID=#{league_id}" \ "&Season=#{season_str}&SeasonType=#{opts.fetch(:season_type)}" end |
.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
67 68 69 |
# File 'lib/nba/cume_stats_player_games.rb', line 67 def self.build(opts) base_path(opts) + optional_params(opts) end |
.optional_params(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 optional parameters string from options
88 89 90 91 92 93 94 95 96 |
# File 'lib/nba/cume_stats_player_games.rb', line 88 def self.optional_params(opts) path = "" path += "&Location=#{opts.fetch(:location)}" if opts.fetch(:location) path += "&Outcome=#{opts.fetch(:outcome)}" if opts.fetch(:outcome) path += "&VsConference=#{opts.fetch(:vs_conference)}" if opts.fetch(:vs_conference) path += "&VsDivision=#{opts.fetch(:vs_division)}" if opts.fetch(:vs_division) path += "&VsTeamID=#{Utils.extract_id(opts.fetch(:vs_team))}" if opts.fetch(:vs_team) path end |