Class: LolesportsApi::Player

Inherits:
BaseApiObject show all
Defined in:
lib/lolesports-api/player.rb

Constant Summary collapse

API_URL =
'http://na.lolesports.com/api/player'

Constants inherited from BaseApiObject

BaseApiObject::SCHEDULE_URL

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseApiObject

fail_by_status, find, #reload

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_urlObject (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

#bioObject (readonly)

Returns the value of attribute bio.



3
4
5
# File 'lib/lolesports-api/player.rb', line 3

def bio
  @bio
end

#contract_expirationObject (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_nameObject (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

#hometownObject (readonly)

Returns the value of attribute hometown.



3
4
5
# File 'lib/lolesports-api/player.rb', line 3

def hometown
  @hometown
end

#idObject (readonly)

Returns the value of attribute id.



3
4
5
# File 'lib/lolesports-api/player.rb', line 3

def id
  @id
end

#is_starterObject (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_nameObject (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

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/lolesports-api/player.rb', line 3

def name
  @name
end

#photo_urlObject (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_urlObject (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

#residencyObject (readonly)

Returns the value of attribute residency.



3
4
5
# File 'lib/lolesports-api/player.rb', line 3

def residency
  @residency
end

#roleObject (readonly)

Returns the value of attribute role.



3
4
5
# File 'lib/lolesports-api/player.rb', line 3

def role
  @role
end

#role_idObject (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_idObject (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

.allObject



29
30
31
# File 'lib/lolesports-api/player.rb', line 29

def self.all
  fail StandardError, 'No API endpoint available.'
end