Class: Ampt::Status

Inherits:
Object
  • Object
show all
Defined in:
lib/ampt_api/acoustics.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(player, can_skip, whoami, now_playing, playlist) ⇒ Status

Returns a new instance of Status.



205
206
207
208
209
210
211
212
213
214
215
216
217
218
# File 'lib/ampt_api/acoustics.rb', line 205

def initialize player, can_skip, whoami, now_playing, playlist
    if player
        player.each do |k,v|
            meta_eval do
                attr_reader k
            end
            instance_variable_set '@'+k, v
        end
    end
    @can_skip = can_skip
    @who = whoami
    @playlist = playlist
    @now_playing = now_playing
end

Instance Attribute Details

#now_playingObject (readonly)

Returns the value of attribute now_playing.



191
192
193
# File 'lib/ampt_api/acoustics.rb', line 191

def now_playing
  @now_playing
end

#playlistObject (readonly)

Returns the value of attribute playlist.



191
192
193
# File 'lib/ampt_api/acoustics.rb', line 191

def playlist
  @playlist
end

#whoObject (readonly)

Returns the value of attribute who.



191
192
193
# File 'lib/ampt_api/acoustics.rb', line 191

def who
  @who
end

Class Method Details

.json_create(o) ⇒ Object



192
193
194
195
196
197
198
199
200
201
202
203
# File 'lib/ampt_api/acoustics.rb', line 192

def self.json_create(o)
    o = o['data']
    playlist = if o['playlist']
        playlist = o['playlist'].collect do |s|
            Song.json_create('data' => s)
        end
    else
        []
    end
    now_playing= Song.json_create('data' => o['now_playing'])
    new o['player'], o['can_skip'], o['who'], now_playing, playlist
end

Instance Method Details

#can_skip?Boolean

Returns:

  • (Boolean)


220
221
222
# File 'lib/ampt_api/acoustics.rb', line 220

def can_skip?
    @can_skip
end