Class: YFantasy::Api::SubresourceParamBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/y_fantasy/api/subresource_param_builder.rb

Defined Under Namespace

Classes: Error

Constant Summary collapse

SUBRESOURCE_MAP =
{
  draft_results: :draftresults,
  ownership_percentage: :percent_owned,
  team_standings: :standings
}
PLAYER_FILTERS =
[
  :count,
  :position,
  :search,
  :sort,
  :sort_type,
  :start,
  :status
].freeze

Instance Method Summary collapse

Constructor Details

#initialize(subresources = [], **options) ⇒ SubresourceParamBuilder

Returns a new instance of SubresourceParamBuilder.



22
23
24
25
26
27
# File 'lib/y_fantasy/api/subresource_param_builder.rb', line 22

def initialize(subresources = [], **options)
  @regular_subs, @nested_subs = normalize_subresources(subresources)
  @week = options.delete(:week)
  @player_filters = set_player_filters(options)
  @options = options
end

Instance Method Details

#buildObject



29
30
31
32
33
34
35
36
37
# File 'lib/y_fantasy/api/subresource_param_builder.rb', line 29

def build
  @params = +""
  add_regular_subresource_segments
  add_nested_subresource_segments
  add_subresource_keys
  add_week
  add_player_filters
  @params
end