Class: Influxdb::Api::Namespaces::Series
Instance Attribute Summary
Attributes inherited from WithDatabase
#database_name
Attributes inherited from Base
#client
Instance Method Summary
collapse
#initialize
Methods inherited from Base
#create, #delete, #initialize
Instance Method Details
#all ⇒ Object
9
10
11
12
13
|
# File 'lib/influxdb/api/namespaces/series.rb', line 9
def all
raw_execute('SELECT * FROM /.*/ LIMIT 1').map{|s| s['name']}
rescue Client::Errors::BadRequest => e
[]
end
|
#execute(*args) ⇒ Object
26
27
28
29
30
31
32
|
# File 'lib/influxdb/api/namespaces/series.rb', line 26
def execute(*args)
raw_execute(*args).each_with_object({}) do |block_of_series, result|
result[block_of_series['name']] = block_of_series['points'].map do |point|
Hash[block_of_series['columns'].zip(point)]
end
end
end
|
#raw_execute(query_string, time_precision = nil) ⇒ Object
34
35
36
37
38
|
# File 'lib/influxdb/api/namespaces/series.rb', line 34
def raw_execute(query_string, time_precision = nil)
params = { q: query_string }
params[:time_precision] = time_precision if time_precision
perform_get(resource_path, params)
end
|
#write(*series) ⇒ Object
15
16
17
18
19
20
21
22
23
24
|
# File 'lib/influxdb/api/namespaces/series.rb', line 15
def write(*series)
series = if series.first.is_a?(String) || series.first.is_a?(Symbol)
{ series.shift => series.shift }
else
series.shift
end
series = series.map{|name, points| writing_block(name, Array.wrap(points)) }
perform_writing(series)
end
|