Class: Infostrada::Referee

Inherits:
Object
  • Object
show all
Defined in:
lib/infostrada/referee.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash = {}, &block) ⇒ Referee

Returns a new instance of Referee.



13
14
15
16
17
18
19
20
21
22
# File 'lib/infostrada/referee.rb', line 13

def initialize(hash = {}, &block)
  @id = hash.delete('n_RefereeID')

  @name = hash.delete('c_Referee')

  @nation = Nation.new(hash, 'referee')

  block.call(self) if block_given?
  self
end

Instance Attribute Details

#idObject

Returns the value of attribute id.



3
4
5
# File 'lib/infostrada/referee.rb', line 3

def id
  @id
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/infostrada/referee.rb', line 3

def name
  @name
end

#nationObject

Returns the value of attribute nation.



3
4
5
# File 'lib/infostrada/referee.rb', line 3

def nation
  @nation
end

Class Method Details

.from_json(json = {}) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/infostrada/referee.rb', line 5

def self.from_json(json = {})
  self.new do |referee|
    referee.id     = json['id']
    referee.name   = json['name']
    referee.nation = json['nation']
  end
end