class Shoutcast::Api::Station

Attributes

bitrate[RW]
br[RW]
ct[RW]
current_track[RW]
genres[RW]
id[RW]
lc[RW]
media_type[RW]
mt[RW]
name[RW]

Public Class Methods

parse(attributes) click to toggle source
# File lib/shoutcast/api/station.rb, line 10
def parse(attributes)
  station        = new
  station.id     = attributes['@id']
  station.name   = attributes['@name']
  station.mt     = attributes['@mt']
  station.br     = attributes['@br']
  station.genres = parse_genres(attributes)
  station.ct     = attributes['@ct']
  station.lc     = attributes['@lc']
  station.logo   = attributes['@logo']
  station
end

Private Class Methods

parse_genres(attributes) click to toggle source
# File lib/shoutcast/api/station.rb, line 25
def parse_genres(attributes)
  genres = []
  current_genre = attributes['@genre']
  genre_index = 1
  until current_genre.nil?
    genres << current_genre
    genre_index += 1
    current_genre = attributes["@genre#{genre_index}"]
  end
  genres
end