class SportsDataApi::Golf::Summary

Attributes

course_timezone[R]
coverage[R]
currency[R]
data[R]
end_date[R]
event_type[R]
id[R]
name[R]
points[R]
purse[R]
start_date[R]
status[R]
tour[R]
winning_share[R]
year[R]

Public Class Methods

new(tour, year, data) click to toggle source
# File lib/sports_data_api/golf/summary.rb, line 8
def initialize(tour, year, data)
  @tour = tour
  @year = year
  @data = data
  @id = data['id']
  @name = data['name']
  @purse = data['purse']
  @winning_share = data['winning_share']
  @currency = data['currency']
  @points = data['points']
  @event_type = data['event_type']
  @start_date = data['start_date']
  @end_date = data['end_date']
  @course_timezone = data['course_timezone']
  @coverage = data['coverage']
  @status = data['status']
end

Public Instance Methods

field() click to toggle source
# File lib/sports_data_api/golf/summary.rb, line 26
def field
  @field ||= safe_map('field') do |json|
    SportsDataApi::Golf::Player.new(json)
  end
end
rounds() click to toggle source
# File lib/sports_data_api/golf/summary.rb, line 32
def rounds
  @rounds ||= safe_map('rounds') do |json|
    SportsDataApi::Golf::Round.new(json)
  end
end

Private Instance Methods

safe_map(field) { |val| ... } click to toggle source
# File lib/sports_data_api/golf/summary.rb, line 42
def safe_map(field)
  data[field].map { |val| yield(val) } if data[field]
end