influxdb 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +6 -14
- data/.travis.yml +0 -2
- data/README.md +10 -0
- data/influxdb.gemspec +0 -1
- data/lib/influxdb/client.rb +11 -2
- data/lib/influxdb/version.rb +1 -1
- data/spec/influxdb/client_spec.rb +11 -0
- metadata +13 -27
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
metadata.gz: !binary |-
|
9
|
-
MTZkYjY3NzQ0Y2Q1NjJlZWFjMGRmM2U4MjdiM2VlYzlmY2U3ZmYwY2IwZDM5
|
10
|
-
YjkzNjkxZDAzM2RkMTZmNWY2ODk5MjkwNTM5NmQ1ODYwY2U0NDRlOTk1MDI5
|
11
|
-
Mjk5YjI0Mzk1NGZhYzc5MGIyNWI3ZjI5NDc2NmVhZDEwMGM0Yjc=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
NjI0YzgyZGM2MzgwODg3YTJkZTE1ZDA1MjBkMjU2NzRhZjFiZWNjZmJiMmUw
|
14
|
-
M2QxNGYyN2Q2NGM2ODI2ODdjMDE1YTcyNmZlZTliMjVmMTdiNmEwYjFkYWQ3
|
15
|
-
N2QzMGQ1Yjc1ZGFmNzg3OWFkNDE2NTBlYmIxZjk3OGZmZGNhOTg=
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 86ce9db8e67f64000501c1db00199e43d8ab5e77
|
4
|
+
data.tar.gz: ab7ec833b6428d02a5a06500140685268f4a27ce
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 61f2f05677101108e2322262166847dc010bd8615e69e2b53d1efab5968e7083f10e8dfdc4d5406cf47b1a65bed46a382d8b813a515d3a99176b687348401231
|
7
|
+
data.tar.gz: 3db8c9ad364c52a04c1d66035c4ce80b6c9a3b0b9c6045a0f039e5b7d74faf2000d1ae183d3a33890710a70073b5b7f0daf2dffdf2ae6152f7c3eb05f6015bdd
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -76,6 +76,16 @@ influxdb = InfluxDB::Client.new
|
|
76
76
|
influxdb.get_database_list
|
77
77
|
```
|
78
78
|
|
79
|
+
List database users:
|
80
|
+
|
81
|
+
``` ruby
|
82
|
+
require 'influxdb'
|
83
|
+
|
84
|
+
influxdb = InfluxDB::Client.new
|
85
|
+
|
86
|
+
influxdb.get_database_user_list(database)
|
87
|
+
```
|
88
|
+
|
79
89
|
Delete a database:
|
80
90
|
|
81
91
|
``` ruby
|
data/influxdb.gemspec
CHANGED
data/lib/influxdb/client.rb
CHANGED
@@ -1,10 +1,11 @@
|
|
1
|
+
require 'uri'
|
1
2
|
require 'net/http'
|
2
3
|
require 'json'
|
3
|
-
require 'addressable/uri'
|
4
4
|
|
5
5
|
module InfluxDB
|
6
6
|
class Client
|
7
7
|
attr_accessor :host, :port, :username, :password, :database
|
8
|
+
attr_accessor :worker
|
8
9
|
|
9
10
|
# Initializes a new Influxdb client
|
10
11
|
#
|
@@ -65,6 +66,14 @@ module InfluxDB
|
|
65
66
|
response = http.request(Net::HTTP::Post.new(url), data)
|
66
67
|
end
|
67
68
|
|
69
|
+
def get_database_user_list(database)
|
70
|
+
http = Net::HTTP.new(@host, @port)
|
71
|
+
url = "/db/#{database}/users?u=#{@username}&p=#{@password}"
|
72
|
+
|
73
|
+
response = http.request(Net::HTTP::Get.new(url))
|
74
|
+
JSON.parse(response.body)
|
75
|
+
end
|
76
|
+
|
68
77
|
def write_point(name, data)
|
69
78
|
http = Net::HTTP.new(@host, @port)
|
70
79
|
url = "/db/#{@database}/series?u=#{@username}&p=#{@password}"
|
@@ -87,7 +96,7 @@ module InfluxDB
|
|
87
96
|
def query query
|
88
97
|
http = Net::HTTP.new(@host, @port)
|
89
98
|
url = "/db/#{@database}/series?u=#{@username}&p=#{@password}&q=#{query}"
|
90
|
-
url =
|
99
|
+
url = URI.encode url
|
91
100
|
response = http.request(Net::HTTP::Get.new(url))
|
92
101
|
series = JSON.parse(response.body)
|
93
102
|
|
data/lib/influxdb/version.rb
CHANGED
@@ -73,6 +73,17 @@ describe InfluxDB::Client do
|
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
76
|
+
describe "#get_database_user_list" do
|
77
|
+
it "should GET a list of database users" do
|
78
|
+
user_list = [{"username"=>"user1"}, {"username"=>"user2"}]
|
79
|
+
stub_request(:get, "http://influxdb.test:9999/db/foo/users").with(
|
80
|
+
:query => {:u => "username", :p => "password"}
|
81
|
+
).to_return(:body => JSON.generate(user_list, :status => 200))
|
82
|
+
|
83
|
+
@influxdb.get_database_user_list("foo").should == user_list
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
76
87
|
describe "#write_point" do
|
77
88
|
it "should POST to add points" do
|
78
89
|
body = [{
|
metadata
CHANGED
@@ -1,41 +1,27 @@
|
|
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.8
|
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-11-
|
11
|
+
date: 2013-11-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
25
|
-
- !ruby/object:Gem::Version
|
26
|
-
version: '0'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: addressable
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ! '>='
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :runtime
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - ! '>='
|
24
|
+
- - '>='
|
39
25
|
- !ruby/object:Gem::Version
|
40
26
|
version: '0'
|
41
27
|
- !ruby/object:Gem::Dependency
|
@@ -56,42 +42,42 @@ dependencies:
|
|
56
42
|
name: rake
|
57
43
|
requirement: !ruby/object:Gem::Requirement
|
58
44
|
requirements:
|
59
|
-
- -
|
45
|
+
- - '>='
|
60
46
|
- !ruby/object:Gem::Version
|
61
47
|
version: '0'
|
62
48
|
type: :development
|
63
49
|
prerelease: false
|
64
50
|
version_requirements: !ruby/object:Gem::Requirement
|
65
51
|
requirements:
|
66
|
-
- -
|
52
|
+
- - '>='
|
67
53
|
- !ruby/object:Gem::Version
|
68
54
|
version: '0'
|
69
55
|
- !ruby/object:Gem::Dependency
|
70
56
|
name: rspec
|
71
57
|
requirement: !ruby/object:Gem::Requirement
|
72
58
|
requirements:
|
73
|
-
- -
|
59
|
+
- - '>='
|
74
60
|
- !ruby/object:Gem::Version
|
75
61
|
version: '0'
|
76
62
|
type: :development
|
77
63
|
prerelease: false
|
78
64
|
version_requirements: !ruby/object:Gem::Requirement
|
79
65
|
requirements:
|
80
|
-
- -
|
66
|
+
- - '>='
|
81
67
|
- !ruby/object:Gem::Version
|
82
68
|
version: '0'
|
83
69
|
- !ruby/object:Gem::Dependency
|
84
70
|
name: webmock
|
85
71
|
requirement: !ruby/object:Gem::Requirement
|
86
72
|
requirements:
|
87
|
-
- -
|
73
|
+
- - '>='
|
88
74
|
- !ruby/object:Gem::Version
|
89
75
|
version: '0'
|
90
76
|
type: :development
|
91
77
|
prerelease: false
|
92
78
|
version_requirements: !ruby/object:Gem::Requirement
|
93
79
|
requirements:
|
94
|
-
- -
|
80
|
+
- - '>='
|
95
81
|
- !ruby/object:Gem::Version
|
96
82
|
version: '0'
|
97
83
|
description: This is the official Ruby library for InfluxDB.
|
@@ -124,17 +110,17 @@ require_paths:
|
|
124
110
|
- lib
|
125
111
|
required_ruby_version: !ruby/object:Gem::Requirement
|
126
112
|
requirements:
|
127
|
-
- -
|
113
|
+
- - '>='
|
128
114
|
- !ruby/object:Gem::Version
|
129
115
|
version: '0'
|
130
116
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
131
117
|
requirements:
|
132
|
-
- -
|
118
|
+
- - '>='
|
133
119
|
- !ruby/object:Gem::Version
|
134
120
|
version: '0'
|
135
121
|
requirements: []
|
136
122
|
rubyforge_project:
|
137
|
-
rubygems_version: 2.0.
|
123
|
+
rubygems_version: 2.0.3
|
138
124
|
signing_key:
|
139
125
|
specification_version: 4
|
140
126
|
summary: Ruby library for InfluxDB.
|