Class: Infostrada::Competition
- Inherits:
-
Object
- Object
- Infostrada::Competition
- Defined in:
- lib/infostrada/competition.rb
Overview
n_CompetitionSet is an indicator for the type of Competition:
1 = domestic league 2 = domestic cup 3 = international club competition (e.g. Champions League) 4 = country competition (e.g. World Cup)
n_CompetitionLevel is an indicator for the level of a domestic competition:
1 = highest level (e.g. German Bundesliga) 2 = 2nd highest level (e.g. German 2. Bundesliga) 3 = 3rd highest level and so on
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#level ⇒ Object
Returns the value of attribute level.
-
#name ⇒ Object
Returns the value of attribute name.
-
#nation ⇒ Object
Returns the value of attribute nation.
-
#set ⇒ Object
Returns the value of attribute set.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(hash = {}, &block) ⇒ Competition
constructor
A new instance of Competition.
Constructor Details
#initialize(hash = {}, &block) ⇒ Competition
Returns a new instance of Competition.
25 26 27 28 29 30 31 32 |
# File 'lib/infostrada/competition.rb', line 25 def initialize(hash = {}, &block) @id = hash.delete('n_CompetitionID') @name = hash.delete('c_Competition') @nation = Nation.new(hash, 'competition') if hash.any? block.call(self) if block_given? self end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
15 16 17 |
# File 'lib/infostrada/competition.rb', line 15 def id @id end |
#level ⇒ Object
Returns the value of attribute level.
15 16 17 |
# File 'lib/infostrada/competition.rb', line 15 def level @level end |
#name ⇒ Object
Returns the value of attribute name.
15 16 17 |
# File 'lib/infostrada/competition.rb', line 15 def name @name end |
#nation ⇒ Object
Returns the value of attribute nation.
15 16 17 |
# File 'lib/infostrada/competition.rb', line 15 def nation @nation end |
#set ⇒ Object
Returns the value of attribute set.
15 16 17 |
# File 'lib/infostrada/competition.rb', line 15 def set @set end |
Class Method Details
.from_json(json = {}) ⇒ Object
17 18 19 20 21 22 23 |
# File 'lib/infostrada/competition.rb', line 17 def self.from_json(json = {}) new do |competition| competition.id = json['id'] competition.name = json['name'] competition.nation = Nation.from_json(json['nation'], 'competition') if json['nation'] end end |