Class: Pandoru::Models::StationList

Inherits:
Collection show all
Defined in:
lib/pandoru/models/station.rb

Instance Attribute Summary

Attributes inherited from Base

#data

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Collection

#<<, #[], #each, #empty?, #first, #initialize, #last, #length, #to_a

Methods inherited from Base

date_field, field, fields, from_json_list, #initialize, #inspect, #populate_from_json, #to_h

Constructor Details

This class inherits a constructor from Pandoru::Models::Collection

Class Method Details

.from_json(api_client, data) ⇒ Object



180
181
182
183
184
185
186
187
188
189
190
# File 'lib/pandoru/models/station.rb', line 180

def self.from_json(api_client, data)
  instance = new(data, api_client)
  instance.populate_from_json(data)
  
  if data['stations']
    stations = Station.from_json_list(api_client, data['stations'])
    stations.each { |station| instance << station }
  end
  
  instance
end

Instance Method Details

#find_by_name(name) ⇒ Object



192
193
194
# File 'lib/pandoru/models/station.rb', line 192

def find_by_name(name)
  find { |station| station.name == name }
end

#quickmix_stationsObject



196
197
198
# File 'lib/pandoru/models/station.rb', line 196

def quickmix_stations
  select(&:is_quickmix)
end

#user_stationsObject



200
201
202
# File 'lib/pandoru/models/station.rb', line 200

def user_stations
  reject(&:is_quickmix)
end