Class: LolesportsApi::Team
- Inherits:
-
BaseApiObject
- Object
- BaseApiObject
- LolesportsApi::Team
- Defined in:
- lib/lolesports-api/team.rb
Constant Summary collapse
- API_URL =
'http://na.lolesports.com/api/team'
Constants inherited from BaseApiObject
Instance Attribute Summary collapse
-
#acronym ⇒ Object
readonly
Returns the value of attribute acronym.
-
#bio ⇒ Object
readonly
Returns the value of attribute bio.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#logo_url ⇒ Object
readonly
Returns the value of attribute logo_url.
-
#losses ⇒ Object
readonly
Returns the value of attribute losses.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#no_players ⇒ Object
readonly
Returns the value of attribute no_players.
-
#profile_url ⇒ Object
readonly
Returns the value of attribute profile_url.
-
#roster ⇒ Object
readonly
Returns the value of attribute roster.
-
#team_photo_url ⇒ Object
readonly
Returns the value of attribute team_photo_url.
-
#wins ⇒ Object
readonly
Returns the value of attribute wins.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ Team
constructor
A new instance of Team.
Methods inherited from BaseApiObject
Constructor Details
#initialize(attributes = {}) ⇒ Team
Returns a new instance of Team.
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/lolesports-api/team.rb', line 9 def initialize(attributes = {}) @id = attributes['id'].to_i @acronym = attributes['acronym'] @bio = attributes['bio'] @logo_url = attributes['logoUrl'] @name = attributes['name'] @no_players = attributes['noPlayers'] @profile_url = attributes['profileUrl'] @roster = [] @team_photo_url = attributes['teamPhotoUrl'] @losses = attributes['losses'] @wins = attributes['wins'] end |
Instance Attribute Details
#acronym ⇒ Object (readonly)
Returns the value of attribute acronym.
3 4 5 |
# File 'lib/lolesports-api/team.rb', line 3 def acronym @acronym end |
#bio ⇒ Object (readonly)
Returns the value of attribute bio.
3 4 5 |
# File 'lib/lolesports-api/team.rb', line 3 def bio @bio end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
3 4 5 |
# File 'lib/lolesports-api/team.rb', line 3 def id @id end |
#logo_url ⇒ Object (readonly)
Returns the value of attribute logo_url.
3 4 5 |
# File 'lib/lolesports-api/team.rb', line 3 def logo_url @logo_url end |
#losses ⇒ Object (readonly)
Returns the value of attribute losses.
3 4 5 |
# File 'lib/lolesports-api/team.rb', line 3 def losses @losses end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/lolesports-api/team.rb', line 3 def name @name end |
#no_players ⇒ Object (readonly)
Returns the value of attribute no_players.
3 4 5 |
# File 'lib/lolesports-api/team.rb', line 3 def no_players @no_players end |
#profile_url ⇒ Object (readonly)
Returns the value of attribute profile_url.
3 4 5 |
# File 'lib/lolesports-api/team.rb', line 3 def profile_url @profile_url end |
#roster ⇒ Object (readonly)
Returns the value of attribute roster.
3 4 5 |
# File 'lib/lolesports-api/team.rb', line 3 def roster @roster end |
#team_photo_url ⇒ Object (readonly)
Returns the value of attribute team_photo_url.
3 4 5 |
# File 'lib/lolesports-api/team.rb', line 3 def team_photo_url @team_photo_url end |
#wins ⇒ Object (readonly)
Returns the value of attribute wins.
3 4 5 |
# File 'lib/lolesports-api/team.rb', line 3 def wins @wins end |
Class Method Details
.find(team_id) ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/lolesports-api/team.rb', line 23 def self.find(team_id) super if @attributes['roster'].any? @attributes['roster'].each_value do |player| @base_object.roster << LolesportsApi::Player.new(player) end end @base_object end |