Class: MusicCast::SetVolume

Inherits:
API
  • Object
show all
Defined in:
lib/music_cast/api/set_volume.rb

Instance Method Summary collapse

Methods inherited from API

#configuration

Instance Method Details

#decrement(step = nil) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/music_cast/api/set_volume.rb', line 19

def decrement(step=nil)
  if step
    make_request("main/setVolume?volume=down&step=#{step.to_i}")
  else
    make_request('main/setVolume?volume=down')
  end
end

#increment(step = nil) ⇒ Object



11
12
13
14
15
16
17
# File 'lib/music_cast/api/set_volume.rb', line 11

def increment(step=nil)
  if step
    make_request("main/setVolume?volume=up&step=#{step.to_i}")
  else
    make_request('main/setVolume?volume=up')
  end
end

#to(value) ⇒ Object



3
4
5
6
7
8
9
# File 'lib/music_cast/api/set_volume.rb', line 3

def to(value)
  unless (0..100).include?(value.to_i)
    raise RequestError, "value #{value} out of bounds 0..100"
  end

  make_request("main/setVolume?volume=#{value.to_i}")
end