Module: CloudConnect::Channels
- Included in:
- Client
- Defined in:
- lib/cloud_connect/client/channels.rb
Instance Method Summary (collapse)
-
- (Array of Hashie::Mash) channels(reload = false)
Retrieve list of channels WARNING: This method uses calls not officially supported by Mobile Devices.
Instance Method Details
- (Array of Hashie::Mash) channels(reload = false)
Retrieve list of channels WARNING: This method uses calls not officially supported by Mobile Devices.
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/cloud_connect/client/channels.rb', line 8 def channels(reload = false) return @channels if @channels && !reload page = 1 limit = 100 channels = [] while (slice = connection.get(connection.build_url("channels", :per_page => limit, :page => page)).body).size > 0 page += 1 channels += slice.map!{|hash| hash.values.first} if slice.size > 0 slice.size < limit ? break : sleep(1) end @channels = channels.sort_by(&:channel) end |