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



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

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



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

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

#quickmix_stationsObject



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

def quickmix_stations
  select(&:is_quickmix)
end

#user_stationsObject



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

def user_stations
  reject(&:is_quickmix)
end