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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 58b0db6ce261ae007787243e7c6654c11a40929f
4
- data.tar.gz: dc6b9173f6a0575257db3430649ce298eda0eb4a
3
+ metadata.gz: 662fe23662ee50914520a7b6521e870b64ecec56
4
+ data.tar.gz: 3c3b9ca62fa7546e4773e11dab83801a0eec281d
5
5
  SHA512:
6
- metadata.gz: 7ac32c6cf939ff9844ea91f969391d46f21d4c632ee2241519abde1e5de9c5169c50b08bb92f87dcc9fd7ca89eda8b5c15249f1938cc97b203c6b6986b84ddb1
7
- data.tar.gz: 7842ff9fa324ccb25172cdb2bd377c47e1da1835b2c50e407b47677d4d7b705e1ec9547aa3bfb8b9dcc845124876a8f6bd545ccd5db38a03d9d2d68bf4eccbe3
6
+ metadata.gz: 480b6b691af386b7a25a985faf357ab729216960afb0cad1a66256d28e5f1be7ed070cfad4c94beb3698ea82c6ed7fbf47795a5298d7c0854949aa605a966dc0
7
+ data.tar.gz: 81d0d1917e4223affb67d0d4883b8ddc31006ce2ba2246d5c2b0ce615556537e1709e5292f101248a8c7f620d0bcc81c4f4c8ac8b721bd0f2b1774885d07f946
@@ -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}"
@@ -1,3 +1,3 @@
1
1
  module InfluxDB
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -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.1
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-29 00:00:00.000000000 Z
11
+ date: 2013-10-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json