Class: SportsDataApi::Golf::Course

Inherits:
Object
  • Object
show all
Defined in:
lib/sports_data_api/golf/course.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Course

Returns a new instance of Course.



6
7
8
9
10
11
12
# File 'lib/sports_data_api/golf/course.rb', line 6

def initialize(data)
  @data = data
  @name = data['name']
  @id = data['id']
  @yardage = data['yardage']
  @par = data['par']
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



4
5
6
# File 'lib/sports_data_api/golf/course.rb', line 4

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/sports_data_api/golf/course.rb', line 4

def name
  @name
end

#parObject (readonly)

Returns the value of attribute par.



4
5
6
# File 'lib/sports_data_api/golf/course.rb', line 4

def par
  @par
end

#yardageObject (readonly)

Returns the value of attribute yardage.



4
5
6
# File 'lib/sports_data_api/golf/course.rb', line 4

def yardage
  @yardage
end

Instance Method Details

#pairingsObject



14
15
16
17
18
# File 'lib/sports_data_api/golf/course.rb', line 14

def pairings
  @pairings ||= data.fetch('pairings', []).map do |json|
    Pairing.new(json)
  end
end