Module: Sense::SleepSounds

Included in:
Client
Defined in:
lib/hello_sense/sleep_sounds.rb

Instance Method Summary collapse

Instance Method Details

#play_soundObject



59
60
61
# File 'lib/hello_sense/sleep_sounds.rb', line 59

def play_sound
  post('/v2/sleep_sounds/play')
end

#sound_durationsHash

Examples:

{
  "durations" => [{
    "id" => 2,
    "name" => "30 Minutes"
  }, {
    "id" => 3,
    "name" => "1 Hour"
  }]
}

Returns:

  • (Hash)


55
56
57
# File 'lib/hello_sense/sleep_sounds.rb', line 55

def sound_durations
  get('/v2/sleep_sounds/durations')
end

#soundsHash

Examples:

{
  "sounds" => [{
    "id" => 18,
    "preview_url" => "https://s3.amazonaws.com/hello-audio/sleep-tones-preview/Aura.mp3",
    "name" => "Aura"
  }, {
    "id" => 20,
    "preview_url" => "https://s3.amazonaws.com/hello-audio/sleep-tones-preview/Nocturne.mp3",
    "name" => "Nocturne"
  }],
  "state" => "OK"
}

Returns:

  • (Hash)


79
80
81
# File 'lib/hello_sense/sleep_sounds.rb', line 79

def sounds
  get('/v2/sleep_sounds/sounds')
end

#sounds_combined_stateHash

Examples:

{
  "availableDurations" => [{
    "durations" => {
      "id" => 2,
      "name" => "30 Minutes"
    }, {
      "id" => 3,
      "name" => "1 Hour"
    }]
  },
  "availableSounds" => [{
    "sounds" => {
      "id" => 18,
      "preview_url" => "https://s3.amazonaws.com/hello-audio/sleep-tones-preview/Aura.mp3",
      "name" => "Aura"
    }, {
      "id" => 20,
      "preview_url" => "https://s3.amazonaws.com/hello-audio/sleep-tones-preview/Nocturne.mp3",
      "name" => "Nocturne"
    }],
    "state" => "OK"
  },
  "status" => {
    "playing" => false,
    "sound" => nil,
    "duration" => nil,
    "volume_percent" => nil
  }
}

Returns:

  • (Hash)


38
39
40
# File 'lib/hello_sense/sleep_sounds.rb', line 38

def sounds_combined_state
  get('/v2/sleep_sounds/combined_state')
end

#sounds_statusHash

Examples:

{
  "playing" => false,
  "sound" => nil,
  "duration" => nil,
  "volume_percent" => nil
}

Returns:

  • (Hash)


93
94
95
# File 'lib/hello_sense/sleep_sounds.rb', line 93

def sounds_status
  get('/v2/sleep_sounds/status')
end

#stop_sounds(data) ⇒ Object



97
98
99
# File 'lib/hello_sense/sleep_sounds.rb', line 97

def stop_sounds(data)
  post('/v2/sleep_sounds/stop', data)
end