Class: Ampt::Status
- Inherits:
-
Object
- Object
- Ampt::Status
- Defined in:
- lib/ampt_api/acoustics.rb
Instance Attribute Summary collapse
-
#now_playing ⇒ Object
readonly
Returns the value of attribute now_playing.
-
#playlist ⇒ Object
readonly
Returns the value of attribute playlist.
-
#who ⇒ Object
readonly
Returns the value of attribute who.
Class Method Summary collapse
Instance Method Summary collapse
- #can_skip? ⇒ Boolean
-
#initialize(player, can_skip, whoami, now_playing, playlist) ⇒ Status
constructor
A new instance of Status.
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, , playlist if player player.each do |k,v| do attr_reader k end instance_variable_set '@'+k, v end end @can_skip = can_skip @who = whoami @playlist = playlist @now_playing = end |
Instance Attribute Details
#now_playing ⇒ Object (readonly)
Returns the value of attribute now_playing.
191 192 193 |
# File 'lib/ampt_api/acoustics.rb', line 191 def @now_playing end |
#playlist ⇒ Object (readonly)
Returns the value of attribute playlist.
191 192 193 |
# File 'lib/ampt_api/acoustics.rb', line 191 def playlist @playlist end |
#who ⇒ Object (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 = Song.json_create('data' => o['now_playing']) new o['player'], o['can_skip'], o['who'], , playlist end |
Instance Method Details
#can_skip? ⇒ Boolean
220 221 222 |
# File 'lib/ampt_api/acoustics.rb', line 220 def can_skip? @can_skip end |