Module: SleepIQ::Sleeper

Included in:
Client
Defined in:
lib/sleepiq/sleeper.rb

Instance Method Summary collapse

Instance Method Details

#sleep_data(date, interval = 'D1') ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/sleepiq/sleeper.rb', line 10

def sleep_data(date, interval = 'D1')
  result = @conn.get do |req|
    req.url 'rest/sleepData'
    req.params = { date: date, interval: interval, _k: @key }
  end
  raise "status code was #{result.status}, #{result.body}" unless result.status == 200

  result.body
end

#sleep_slice_data(date, interval = 'D1') ⇒ Object



20
21
22
23
24
25
26
27
28
# File 'lib/sleepiq/sleeper.rb', line 20

def sleep_slice_data(date, interval = 'D1')
  result = @conn.get do |req|
    req.url 'rest/sleepSliceData'
    req.params = { date: date, interval: interval, _k: @key }
  end
  raise "status code was #{result.status}, #{result.body}" unless result.status == 200

  result.body
end

#sleeperObject



3
4
5
6
7
8
# File 'lib/sleepiq/sleeper.rb', line 3

def sleeper
  result = @conn.get { |req| req.url 'rest/sleeper' }
  raise "status code was #{result.status}, #{result.body}" unless result.status == 200

  result.body
end