Class: Statium::Opta::Model::Competition

Inherits:
Object
  • Object
show all
Defined in:
lib/statium/opta/model/competition.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ Competition

Returns a new instance of Competition



24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/statium/opta/model/competition.rb', line 24

def initialize(params)
  params.each do |key, value|
    instance_variable_set("@#{key}", value)
  end

  @tournamentCalendars = []
  if params["tournamentCalendar"] != nil
    params["tournamentCalendar"].each do |tournament_calendar_params|
      @tournamentCalendars << TournamentCalendar.new(tournament_calendar_params)
    end
  end
end

Instance Attribute Details

#competitionFormatObject

Returns the value of attribute competitionFormat



12
13
14
# File 'lib/statium/opta/model/competition.rb', line 12

def competitionFormat
  @competitionFormat
end

#countryObject

Returns the value of attribute country



9
10
11
# File 'lib/statium/opta/model/competition.rb', line 9

def country
  @country
end

#countryIdObject

Returns the value of attribute countryId



10
11
12
# File 'lib/statium/opta/model/competition.rb', line 10

def countryId
  @countryId
end

#idObject

Returns the value of attribute id



5
6
7
# File 'lib/statium/opta/model/competition.rb', line 5

def id
  @id
end

#isFriendlyObject

Returns the value of attribute isFriendly



11
12
13
# File 'lib/statium/opta/model/competition.rb', line 11

def isFriendly
  @isFriendly
end

#nameObject

Returns the value of attribute name



8
9
10
# File 'lib/statium/opta/model/competition.rb', line 8

def name
  @name
end

#ocIdObject

Returns the value of attribute ocId



6
7
8
# File 'lib/statium/opta/model/competition.rb', line 6

def ocId
  @ocId
end

#opIdObject

Returns the value of attribute opId



7
8
9
# File 'lib/statium/opta/model/competition.rb', line 7

def opId
  @opId
end

#tournamentCalendarsObject

Returns the value of attribute tournamentCalendars



14
15
16
# File 'lib/statium/opta/model/competition.rb', line 14

def tournamentCalendars
  @tournamentCalendars
end

#typeObject

Returns the value of attribute type



13
14
15
# File 'lib/statium/opta/model/competition.rb', line 13

def type
  @type
end

Class Method Details

.build(params) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/statium/opta/model/competition.rb', line 16

def self.build params
  all_competitions = []
  params["competition"].each do |competition_params|
    all_competitions << Competition.new(competition_params)
  end
  all_competitions
end