influxdb 0.0.2 → 0.0.3

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: 662fe23662ee50914520a7b6521e870b64ecec56
4
- data.tar.gz: 3c3b9ca62fa7546e4773e11dab83801a0eec281d
3
+ metadata.gz: e8b59b9b818ffdb252513445a60eacdeae93fa49
4
+ data.tar.gz: 779f22ee66d5017709f38496e9e408e83c2efb05
5
5
  SHA512:
6
- metadata.gz: 480b6b691af386b7a25a985faf357ab729216960afb0cad1a66256d28e5f1be7ed070cfad4c94beb3698ea82c6ed7fbf47795a5298d7c0854949aa605a966dc0
7
- data.tar.gz: 81d0d1917e4223affb67d0d4883b8ddc31006ce2ba2246d5c2b0ce615556537e1709e5292f101248a8c7f620d0bcc81c4f4c8ac8b721bd0f2b1774885d07f946
6
+ metadata.gz: ca55be4627b2396175944f5f14d471a216fa2febb1b3f4db746ff0a2ca42c1b32a78e08be2980e5377f1bea37f35db9f8678c3728abd00fb01f106b2f84a4ae9
7
+ data.tar.gz: e03e5c64acf71ccdeda8a89b4c82879a55341727086d5d5824ad5f88550a7a21d4808010669ee55d83bed9192ad18e6a528d1405d80648c01f3dd68de277622c
data/.gitignore CHANGED
@@ -11,6 +11,7 @@ spec/reports
11
11
  test/tmp
12
12
  test/version_tmp
13
13
  tmp
14
+ Gemfile.lock
14
15
 
15
16
  # YARD artifacts
16
17
  .yardoc
@@ -2,7 +2,7 @@ require "net/http"
2
2
 
3
3
  module InfluxDB
4
4
  class Client
5
- def initialize(host, port, username, password, database)
5
+ def initialize(host, port, username, password, database = nil)
6
6
  @host = host
7
7
  @port = port
8
8
  @username = username
@@ -23,6 +23,12 @@ module InfluxDB
23
23
  response = http.request(Net::HTTP::Delete.new(url))
24
24
  end
25
25
 
26
+ def get_database_list
27
+ http = Net::HTTP.new(@host, @port)
28
+ url = "/dbs?u=#{@username}&p=#{@password}"
29
+ response = http.request(Net::HTTP::Get.new(url))
30
+ end
31
+
26
32
  def create_database_user(database, username, password)
27
33
  http = Net::HTTP.new(@host, @port)
28
34
  url = "/db/#{database}/users?u=#{@username}&p=#{@password}"
@@ -1,3 +1,3 @@
1
1
  module InfluxDB
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -35,6 +35,16 @@ describe InfluxDB::Client do
35
35
  end
36
36
  end
37
37
 
38
+ describe "#get_database_list" do
39
+ it "should GET a list of databases" do
40
+ stub_request(:get, "http://influxdb.test:9999/dbs").with(
41
+ :query => {:u => "username", :p => "password"}
42
+ )
43
+
44
+ @influxdb.get_database_list.should be_a(Net::HTTPOK)
45
+ end
46
+ end
47
+
38
48
  describe "#create_database_user" do
39
49
  it "should POST to create a new database user" do
40
50
  stub_request(:post, "http://influxdb.test:9999/db/foo/users").with(
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.2
4
+ version: 0.0.3
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-30 00:00:00.000000000 Z
11
+ date: 2013-11-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json
@@ -90,7 +90,6 @@ files:
90
90
  - .gitignore
91
91
  - .travis.yml
92
92
  - Gemfile
93
- - Gemfile.lock
94
93
  - LICENSE.txt
95
94
  - README.md
96
95
  - Rakefile
@@ -1,37 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- influxdb (0.0.1)
5
- json
6
-
7
- GEM
8
- remote: https://rubygems.org/
9
- specs:
10
- addressable (2.3.5)
11
- crack (0.4.1)
12
- safe_yaml (~> 0.9.0)
13
- diff-lcs (1.2.4)
14
- json (1.8.1)
15
- rake (10.1.0)
16
- rspec (2.14.1)
17
- rspec-core (~> 2.14.0)
18
- rspec-expectations (~> 2.14.0)
19
- rspec-mocks (~> 2.14.0)
20
- rspec-core (2.14.6)
21
- rspec-expectations (2.14.3)
22
- diff-lcs (>= 1.1.3, < 2.0)
23
- rspec-mocks (2.14.4)
24
- safe_yaml (0.9.7)
25
- webmock (1.15.0)
26
- addressable (>= 2.2.7)
27
- crack (>= 0.3.2)
28
-
29
- PLATFORMS
30
- ruby
31
-
32
- DEPENDENCIES
33
- bundler (~> 1.3)
34
- influxdb!
35
- rake
36
- rspec
37
- webmock