Class: Growbot::Web::Data

Inherits:
Object
  • Object
show all
Defined in:
lib/growbot/web/data.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeData

Returns a new instance of Data.



7
8
# File 'lib/growbot/web/data.rb', line 7

def initialize
end

Instance Attribute Details

#database=(value) ⇒ Object

Sets the attribute database

Parameters:

  • value

    the value to set the attribute database to.



5
6
7
# File 'lib/growbot/web/data.rb', line 5

def database=(value)
  @database = value
end

Instance Method Details

#getObject



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/growbot/web/data.rb', line 10

def get
  dataset = []
  query = <<-QUERY
    FOR row in readings
      FILTER row.moisture != 0
      FILTER row.light != 0
      FILTER row.time >= #{start_time}
      SORT row.time ASC
      RETURN row
  QUERY
  collection.query.execute(query).each do |document|
    dataset << document.to_h
  end
  dataset
end