class LolesportsApi::Series

Constants

API_URL

Attributes

id[R]
label[R]
label_public[R]
season[R]
tournaments[R]
url[R]

Public Class Methods

all() click to toggle source
# File lib/lolesports-api/series.rb, line 26
def self.all
  response_json = JSON.parse Faraday.get("#{API_URL}.json").body
  all_series = []
  response_json.each do |series|
    all_series << new(series)
  end
  all_series
end
find(series_id) click to toggle source
Calls superclass method LolesportsApi::BaseApiObject::find
# File lib/lolesports-api/series.rb, line 17
def self.find(series_id)
  super
  @attributes['tournaments'].each do |tournament|
    @base_object.tournaments <<
      LolesportsApi::Tournament.new('id' => tournament)
  end
  @base_object
end
new(attributes) click to toggle source
# File lib/lolesports-api/series.rb, line 8
def initialize(attributes)
  @id = attributes['id'].to_i
  @label = attributes['label']
  @label_public = attributes['labelPublic']
  @season = attributes['season']
  @tournaments = []
  @url = attributes['url']
end