Class: Infostrada::TeamInfo

Inherits:
BaseRequest show all
Defined in:
lib/infostrada/team_info.rb

Constant Summary collapse

URL =
'/GetTeamInfo'

Constants inherited from BaseRequest

BaseRequest::RETRIES

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseRequest

get!

Constructor Details

#initialize(hash) ⇒ TeamInfo

Returns a new instance of TeamInfo.



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/infostrada/team_info.rb', line 17

def initialize(hash)
  @id                     = hash['teamid']
  @official_name          = hash['c_OfficialName']
  @official_short_name    = hash['c_OfficialNameSort']
  @public_name            = hash['c_PublicName']
  @public_short_name      = hash['c_PublicNameSort']
  @nickname               = hash['c_Nickname']
  @foundation_date        = hash['d_FoundationDate']
  @official_stadium_name  = hash['c_StadiumOfficialName']
  @stadium_name           = hash['c_Stadium']
  @stadium_capacity       = hash['n_StadiumCapacity']
  @url                    = hash['c_URL']
  @city                   = hash['c_City']
  @country                = hash['c_Country']
  @country_short_name     = hash['c_CountryShort']

  self
end

Instance Attribute Details

#cityObject

Returns the value of attribute city.



7
8
9
# File 'lib/infostrada/team_info.rb', line 7

def city
  @city
end

#countryObject

Returns the value of attribute country.



7
8
9
# File 'lib/infostrada/team_info.rb', line 7

def country
  @country
end

#country_short_nameObject

Returns the value of attribute country_short_name.



7
8
9
# File 'lib/infostrada/team_info.rb', line 7

def country_short_name
  @country_short_name
end

#foundation_dateObject

Returns the value of attribute foundation_date.



6
7
8
# File 'lib/infostrada/team_info.rb', line 6

def foundation_date
  @foundation_date
end

#idObject

Returns the value of attribute id.



7
8
9
# File 'lib/infostrada/team_info.rb', line 7

def id
  @id
end

#nicknameObject

Returns the value of attribute nickname.



5
6
7
# File 'lib/infostrada/team_info.rb', line 5

def nickname
  @nickname
end

#official_nameObject

Returns the value of attribute official_name.



5
6
7
# File 'lib/infostrada/team_info.rb', line 5

def official_name
  @official_name
end

#official_short_nameObject

Returns the value of attribute official_short_name.



5
6
7
# File 'lib/infostrada/team_info.rb', line 5

def official_short_name
  @official_short_name
end

#official_stadium_nameObject

Returns the value of attribute official_stadium_name.



6
7
8
# File 'lib/infostrada/team_info.rb', line 6

def official_stadium_name
  @official_stadium_name
end

#public_nameObject

Returns the value of attribute public_name.



5
6
7
# File 'lib/infostrada/team_info.rb', line 5

def public_name
  @public_name
end

#public_short_nameObject

Returns the value of attribute public_short_name.



5
6
7
# File 'lib/infostrada/team_info.rb', line 5

def public_short_name
  @public_short_name
end

#stadium_capacityObject

Returns the value of attribute stadium_capacity.



6
7
8
# File 'lib/infostrada/team_info.rb', line 6

def stadium_capacity
  @stadium_capacity
end

#stadium_nameObject

Returns the value of attribute stadium_name.



6
7
8
# File 'lib/infostrada/team_info.rb', line 6

def stadium_name
  @stadium_name
end

#urlObject

Returns the value of attribute url.



7
8
9
# File 'lib/infostrada/team_info.rb', line 7

def url
  @url
end

Class Method Details

.fetch(team_id) ⇒ Object



11
12
13
14
15
# File 'lib/infostrada/team_info.rb', line 11

def self.fetch(team_id)
  info_hash = get!(URL, query: { teamid: team_id.to_i })

  info_hash.first ? new(info_hash.first.merge({ 'teamid' => team_id.to_i })) : nil
end