influxdb 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +14 -6
- data/README.md +22 -29
- data/lib/influxdb/client.rb +1 -1
- data/lib/influxdb/version.rb +1 -1
- data/spec/influxdb/client_spec.rb +1 -1
- metadata +14 -14
checksums.yaml
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
MTUyOGQ2YTI1Y2NiYTg4MjM5Y2YxNmEzMTliM2RhYTYwNjcwMWVhYw==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
ZTc3OWZlOTgwYmNiZjA0MWRjMDM0NGFlZmExZjU1MDRlOGVkNmU1MA==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
MTZkYjY3NzQ0Y2Q1NjJlZWFjMGRmM2U4MjdiM2VlYzlmY2U3ZmYwY2IwZDM5
|
10
|
+
YjkzNjkxZDAzM2RkMTZmNWY2ODk5MjkwNTM5NmQ1ODYwY2U0NDRlOTk1MDI5
|
11
|
+
Mjk5YjI0Mzk1NGZhYzc5MGIyNWI3ZjI5NDc2NmVhZDEwMGM0Yjc=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
NjI0YzgyZGM2MzgwODg3YTJkZTE1ZDA1MjBkMjU2NzRhZjFiZWNjZmJiMmUw
|
14
|
+
M2QxNGYyN2Q2NGM2ODI2ODdjMDE1YTcyNmZlZTliMjVmMTdiNmEwYjFkYWQ3
|
15
|
+
N2QzMGQ1Yjc1ZGFmNzg3OWFkNDE2NTBlYmIxZjk3OGZmZGNhOTg=
|
data/README.md
CHANGED
@@ -22,13 +22,7 @@ Create a database:
|
|
22
22
|
``` ruby
|
23
23
|
require 'influxdb'
|
24
24
|
|
25
|
-
|
26
|
-
port = 8086
|
27
|
-
username = 'root'
|
28
|
-
password = 'root'
|
29
|
-
database = 'site_development'
|
30
|
-
|
31
|
-
influxdb = InfluxDB::Client.new(hostname, port, username, password)
|
25
|
+
influxdb = InfluxDB::Client.new
|
32
26
|
|
33
27
|
influxdb.create_database(database)
|
34
28
|
```
|
@@ -38,14 +32,9 @@ Create a user for a database:
|
|
38
32
|
``` ruby
|
39
33
|
require 'influxdb'
|
40
34
|
|
41
|
-
|
42
|
-
port = 8086
|
43
|
-
username = 'root'
|
44
|
-
password = 'root'
|
45
|
-
database = 'site_development'
|
46
|
-
|
47
|
-
influxdb = InfluxDB::Client.new(hostname, port, username, password)
|
35
|
+
influxdb = InfluxDB::Client.new
|
48
36
|
|
37
|
+
database = 'site_development'
|
49
38
|
new_username = 'foo'
|
50
39
|
new_password = 'bar'
|
51
40
|
influxdb.create_database_user(database, new_username, new_password)
|
@@ -56,14 +45,12 @@ Write some data:
|
|
56
45
|
``` ruby
|
57
46
|
require 'influxdb'
|
58
47
|
|
59
|
-
hostname = 'localhost'
|
60
|
-
port = 8086
|
61
48
|
username = 'foo'
|
62
49
|
password = 'bar'
|
63
50
|
database = 'site_development'
|
64
51
|
name = 'foobar'
|
65
52
|
|
66
|
-
influxdb = InfluxDB::Client.new
|
53
|
+
influxdb = InfluxDB::Client.new database, :username => username, :password => password
|
67
54
|
|
68
55
|
# Enumerator that emits a sine wave
|
69
56
|
Value = (0..360).to_a.map {|i| Math.send(:sin, i / 10.0) * 10 }.each
|
@@ -84,12 +71,7 @@ List databases:
|
|
84
71
|
``` ruby
|
85
72
|
require 'influxdb'
|
86
73
|
|
87
|
-
|
88
|
-
port = 8086
|
89
|
-
username = 'root'
|
90
|
-
password = 'root'
|
91
|
-
|
92
|
-
influxdb = InfluxDB::Client.new(hostname, 8086, username, password)
|
74
|
+
influxdb = InfluxDB::Client.new
|
93
75
|
|
94
76
|
influxdb.get_database_list
|
95
77
|
```
|
@@ -99,15 +81,26 @@ Delete a database:
|
|
99
81
|
``` ruby
|
100
82
|
require 'influxdb'
|
101
83
|
|
102
|
-
|
103
|
-
|
104
|
-
username = 'root'
|
105
|
-
password = 'root'
|
84
|
+
influxdb = InfluxDB::Client.new
|
85
|
+
|
106
86
|
database = 'site_development'
|
87
|
+
influxdb.delete_database(database)
|
88
|
+
```
|
107
89
|
|
108
|
-
|
90
|
+
Querying:
|
109
91
|
|
110
|
-
|
92
|
+
``` ruby
|
93
|
+
require 'influxdb'
|
94
|
+
|
95
|
+
username = 'foo'
|
96
|
+
password = 'bar'
|
97
|
+
database = 'site_development'
|
98
|
+
|
99
|
+
influxdb = InfluxDB::Client.new database, :username => username, :password => password
|
100
|
+
|
101
|
+
influxdb.query 'select * from time_series_1' do |name, points|
|
102
|
+
puts "#{name} => #{points}"
|
103
|
+
end
|
111
104
|
```
|
112
105
|
|
113
106
|
|
data/lib/influxdb/client.rb
CHANGED
@@ -86,7 +86,7 @@ module InfluxDB
|
|
86
86
|
|
87
87
|
def query query
|
88
88
|
http = Net::HTTP.new(@host, @port)
|
89
|
-
url = "/db/#{@database}/
|
89
|
+
url = "/db/#{@database}/series?u=#{@username}&p=#{@password}&q=#{query}"
|
90
90
|
url = Addressable::URI.encode url
|
91
91
|
response = http.request(Net::HTTP::Get.new(url))
|
92
92
|
series = JSON.parse(response.body)
|
data/lib/influxdb/version.rb
CHANGED
@@ -131,7 +131,7 @@ describe InfluxDB::Client do
|
|
131
131
|
before(:each) do
|
132
132
|
data = [{ :name => "foo", :columns => ["name", "age"], :values => [["shahid", 99],["dix", 50]]}]
|
133
133
|
|
134
|
-
stub_request(:get, "http://influxdb.test:9999/db/database/
|
134
|
+
stub_request(:get, "http://influxdb.test:9999/db/database/series").with(
|
135
135
|
:query => { :q => "select * from foo", :u => "username", :p => "password"}
|
136
136
|
).to_return(
|
137
137
|
:body => JSON.generate(data)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
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.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Todd Persen
|
@@ -14,28 +14,28 @@ dependencies:
|
|
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
|
-
- - '>='
|
24
|
+
- - ! '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: addressable
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - '>='
|
31
|
+
- - ! '>='
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - '>='
|
38
|
+
- - ! '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
@@ -56,42 +56,42 @@ dependencies:
|
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - '>='
|
59
|
+
- - ! '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - '>='
|
66
|
+
- - ! '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - '>='
|
73
|
+
- - ! '>='
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - '>='
|
80
|
+
- - ! '>='
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: webmock
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - '>='
|
87
|
+
- - ! '>='
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - '>='
|
94
|
+
- - ! '>='
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
description: This is the official Ruby library for InfluxDB.
|
@@ -124,17 +124,17 @@ require_paths:
|
|
124
124
|
- lib
|
125
125
|
required_ruby_version: !ruby/object:Gem::Requirement
|
126
126
|
requirements:
|
127
|
-
- - '>='
|
127
|
+
- - ! '>='
|
128
128
|
- !ruby/object:Gem::Version
|
129
129
|
version: '0'
|
130
130
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
131
131
|
requirements:
|
132
|
-
- - '>='
|
132
|
+
- - ! '>='
|
133
133
|
- !ruby/object:Gem::Version
|
134
134
|
version: '0'
|
135
135
|
requirements: []
|
136
136
|
rubyforge_project:
|
137
|
-
rubygems_version: 2.0.
|
137
|
+
rubygems_version: 2.0.7
|
138
138
|
signing_key:
|
139
139
|
specification_version: 4
|
140
140
|
summary: Ruby library for InfluxDB.
|