Class: LolesportsApi::Player
- Inherits:
-
BaseApiObject
- Object
- BaseApiObject
- LolesportsApi::Player
- Defined in:
- lib/lolesports-api/player.rb
Constant Summary collapse
- API_URL =
'http://na.lolesports.com/api/player'
Constants inherited from BaseApiObject
Instance Attribute Summary collapse
-
#api_url ⇒ Object
readonly
Returns the value of attribute api_url.
-
#bio ⇒ Object
readonly
Returns the value of attribute bio.
-
#contract_expiration ⇒ Object
readonly
Returns the value of attribute contract_expiration.
-
#first_name ⇒ Object
readonly
Returns the value of attribute first_name.
-
#hometown ⇒ Object
readonly
Returns the value of attribute hometown.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#is_starter ⇒ Object
readonly
Returns the value of attribute is_starter.
-
#last_name ⇒ Object
readonly
Returns the value of attribute last_name.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#photo_url ⇒ Object
readonly
Returns the value of attribute photo_url.
-
#profile_url ⇒ Object
readonly
Returns the value of attribute profile_url.
-
#residency ⇒ Object
readonly
Returns the value of attribute residency.
-
#role ⇒ Object
readonly
Returns the value of attribute role.
-
#role_id ⇒ Object
readonly
Returns the value of attribute role_id.
-
#team_id ⇒ Object
readonly
Returns the value of attribute team_id.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ Player
constructor
A new instance of Player.
Methods inherited from BaseApiObject
Constructor Details
#initialize(attributes = {}) ⇒ Player
Returns a new instance of Player.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/lolesports-api/player.rb', line 10 def initialize(attributes = {}) @id = attributes['id'] || attributes['playerId'].to_i @name = attributes['name'] @bio = attributes['bio'] @first_name = attributes['firstname'] @last_name = attributes['lastName'] @team_id = attributes['teamId'] @role = attributes['role'] @role_id = attributes['roleId'] @is_starter = attributes['isStarter'] @hometown = attributes['hometown'] @photo_url = attributes['photoUrl'] @profile_url = attributes['profileUrl'] @residency = attributes['residency'] @contract_expiration = parse_datetime(attributes['contractExpiration']) self end |
Instance Attribute Details
#api_url ⇒ Object (readonly)
Returns the value of attribute api_url.
3 4 5 |
# File 'lib/lolesports-api/player.rb', line 3 def api_url @api_url end |
#bio ⇒ Object (readonly)
Returns the value of attribute bio.
3 4 5 |
# File 'lib/lolesports-api/player.rb', line 3 def bio @bio end |
#contract_expiration ⇒ Object (readonly)
Returns the value of attribute contract_expiration.
3 4 5 |
# File 'lib/lolesports-api/player.rb', line 3 def contract_expiration @contract_expiration end |
#first_name ⇒ Object (readonly)
Returns the value of attribute first_name.
3 4 5 |
# File 'lib/lolesports-api/player.rb', line 3 def first_name @first_name end |
#hometown ⇒ Object (readonly)
Returns the value of attribute hometown.
3 4 5 |
# File 'lib/lolesports-api/player.rb', line 3 def hometown @hometown end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
3 4 5 |
# File 'lib/lolesports-api/player.rb', line 3 def id @id end |
#is_starter ⇒ Object (readonly)
Returns the value of attribute is_starter.
3 4 5 |
# File 'lib/lolesports-api/player.rb', line 3 def is_starter @is_starter end |
#last_name ⇒ Object (readonly)
Returns the value of attribute last_name.
3 4 5 |
# File 'lib/lolesports-api/player.rb', line 3 def last_name @last_name end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/lolesports-api/player.rb', line 3 def name @name end |
#photo_url ⇒ Object (readonly)
Returns the value of attribute photo_url.
3 4 5 |
# File 'lib/lolesports-api/player.rb', line 3 def photo_url @photo_url end |
#profile_url ⇒ Object (readonly)
Returns the value of attribute profile_url.
3 4 5 |
# File 'lib/lolesports-api/player.rb', line 3 def profile_url @profile_url end |
#residency ⇒ Object (readonly)
Returns the value of attribute residency.
3 4 5 |
# File 'lib/lolesports-api/player.rb', line 3 def residency @residency end |
#role ⇒ Object (readonly)
Returns the value of attribute role.
3 4 5 |
# File 'lib/lolesports-api/player.rb', line 3 def role @role end |
#role_id ⇒ Object (readonly)
Returns the value of attribute role_id.
3 4 5 |
# File 'lib/lolesports-api/player.rb', line 3 def role_id @role_id end |
#team_id ⇒ Object (readonly)
Returns the value of attribute team_id.
3 4 5 |
# File 'lib/lolesports-api/player.rb', line 3 def team_id @team_id end |
Class Method Details
.all ⇒ Object
29 30 31 |
# File 'lib/lolesports-api/player.rb', line 29 def self.all fail StandardError, 'No API endpoint available.' end |