influxdb 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/influxdb/client.rb +7 -0
- data/lib/influxdb/version.rb +1 -1
- data/spec/influxdb/client_spec.rb +10 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 662fe23662ee50914520a7b6521e870b64ecec56
|
4
|
+
data.tar.gz: 3c3b9ca62fa7546e4773e11dab83801a0eec281d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 480b6b691af386b7a25a985faf357ab729216960afb0cad1a66256d28e5f1be7ed070cfad4c94beb3698ea82c6ed7fbf47795a5298d7c0854949aa605a966dc0
|
7
|
+
data.tar.gz: 81d0d1917e4223affb67d0d4883b8ddc31006ce2ba2246d5c2b0ce615556537e1709e5292f101248a8c7f620d0bcc81c4f4c8ac8b721bd0f2b1774885d07f946
|
data/lib/influxdb/client.rb
CHANGED
@@ -23,6 +23,13 @@ module InfluxDB
|
|
23
23
|
response = http.request(Net::HTTP::Delete.new(url))
|
24
24
|
end
|
25
25
|
|
26
|
+
def create_database_user(database, username, password)
|
27
|
+
http = Net::HTTP.new(@host, @port)
|
28
|
+
url = "/db/#{database}/users?u=#{@username}&p=#{@password}"
|
29
|
+
data = JSON.generate({:username => username, :password => password})
|
30
|
+
response = http.request(Net::HTTP::Post.new(url), data)
|
31
|
+
end
|
32
|
+
|
26
33
|
def write_point(name, data)
|
27
34
|
http = Net::HTTP.new(@host, @port)
|
28
35
|
url = "/db/#{@database}/series?u=#{@username}&p=#{@password}"
|
data/lib/influxdb/version.rb
CHANGED
@@ -35,6 +35,16 @@ describe InfluxDB::Client do
|
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
|
+
describe "#create_database_user" do
|
39
|
+
it "should POST to create a new database user" do
|
40
|
+
stub_request(:post, "http://influxdb.test:9999/db/foo/users").with(
|
41
|
+
:query => {:u => "username", :p => "password"},
|
42
|
+
:body => JSON.generate({:username => "useruser", :password => "passpass"})
|
43
|
+
)
|
44
|
+
|
45
|
+
@influxdb.create_database_user("foo", "useruser", "passpass").should be_a(Net::HTTPOK)
|
46
|
+
end
|
47
|
+
end
|
38
48
|
|
39
49
|
describe "#write_point" do
|
40
50
|
it "should POST to add points" do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: influxdb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Todd Persen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-10-
|
11
|
+
date: 2013-10-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|