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
|
# File 'lib/influxdb/api/namespaces/series.rb', line 9
def all
raw_execute('list series').map{|s| s['name']}
end
|
#execute(*args) ⇒ Object
24
25
26
27
28
29
30
|
# File 'lib/influxdb/api/namespaces/series.rb', line 24
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
32
33
34
35
36
|
# File 'lib/influxdb/api/namespaces/series.rb', line 32
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
13
14
15
16
17
18
19
20
21
22
|
# File 'lib/influxdb/api/namespaces/series.rb', line 13
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
|