Class: Influxdb::Api::Database

Inherits:
Object
  • Object
show all
Defined in:
lib/influxdb/api/database.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client, name) ⇒ Database

Returns a new instance of Database.



6
7
8
9
# File 'lib/influxdb/api/database.rb', line 6

def initialize(client, name)
  @client = client
  @name = name
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



4
5
6
# File 'lib/influxdb/api/database.rb', line 4

def client
  @client
end

#nameObject (readonly)

Returns the value of attribute name.



4
5
6
# File 'lib/influxdb/api/database.rb', line 4

def name
  @name
end

Instance Method Details

#continuous_queriesObject



19
20
21
22
23
24
25
# File 'lib/influxdb/api/database.rb', line 19

def continuous_queries
  @continuous_queries ||= if client.version > '0.8.3'
    Namespaces::ContinuousQueries::Sql.new(client, name)
  else
    Namespaces::ContinuousQueries::Api.new(client, name)
  end
end

#seriesObject



11
12
13
# File 'lib/influxdb/api/database.rb', line 11

def series
  @series ||= Namespaces::Series.new(client, name)
end

#shard_spacesObject



27
28
29
30
31
32
33
34
35
36
37
# File 'lib/influxdb/api/database.rb', line 27

def shard_spaces
  @shard_spaces ||= begin
    version = client.version
    raise(
      UnsupportedFeature,
      "Shard space's API is supported only after 0.7.3 version. Current is #{version.to_s(:mini)}"
    ) if version < '0.8.3'

    Namespaces::ShardSpaces.new(client, name)
  end
end

#usersObject



15
16
17
# File 'lib/influxdb/api/database.rb', line 15

def users
  @users ||= Namespaces::Users.new(client, name)
end