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.



187
188
189
190
191
192
193
194
195
196
197
198
199
200
# File 'lib/ampt_api/acoustics.rb', line 187

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.



173
174
175
# File 'lib/ampt_api/acoustics.rb', line 173

def now_playing
  @now_playing
end

#playlistObject (readonly)

Returns the value of attribute playlist.



173
174
175
# File 'lib/ampt_api/acoustics.rb', line 173

def playlist
  @playlist
end

#whoObject (readonly)

Returns the value of attribute who.



173
174
175
# File 'lib/ampt_api/acoustics.rb', line 173

def who
  @who
end

Class Method Details

.json_create(o) ⇒ Object



174
175
176
177
178
179
180
181
182
183
184
185
# File 'lib/ampt_api/acoustics.rb', line 174

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)


202
203
204
# File 'lib/ampt_api/acoustics.rb', line 202

def can_skip?
    @can_skip
end