influxdb 0.3.4 → 0.3.5

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG.md CHANGED
@@ -6,6 +6,11 @@ For the full commit log, [see here](https://github.com/influxdata/influxdb-ruby/
6
6
 
7
7
  - None.
8
8
 
9
+ ## v0.3.5, released 2016-06-09
10
+
11
+ - Reintroduced full dependency on "cause" (for Ruby 1.9 compat).
12
+ - Extended `Client#create_database` and `#delete_database` to fallback on `config.database` (#153, #154, @anthonator).
13
+
9
14
  ## v0.3.4, released 2016-06-07
10
15
 
11
16
  - Added resample options to `Client#create_continuous_query` (#149).
data/influxdb.gemspec CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
20
20
  spec.require_paths = ["lib"]
21
21
 
22
22
  spec.add_runtime_dependency "json"
23
- spec.add_runtime_dependency "cause" if RUBY_VERSION < '2.1'
23
+ spec.add_runtime_dependency "cause"
24
24
 
25
25
  spec.add_development_dependency "rake"
26
26
  spec.add_development_dependency "bundler", "~> 1.3"
@@ -1,12 +1,12 @@
1
1
  module InfluxDB
2
2
  module Query
3
3
  module Database # :nodoc:
4
- def create_database(name)
5
- execute("CREATE DATABASE #{name}")
4
+ def create_database(name = nil)
5
+ execute("CREATE DATABASE #{name || config.database}")
6
6
  end
7
7
 
8
- def delete_database(name)
9
- execute("DROP DATABASE #{name}")
8
+ def delete_database(name = nil)
9
+ execute("DROP DATABASE #{name || config.database}")
10
10
  end
11
11
 
12
12
  def list_databases
@@ -1,3 +1,3 @@
1
1
  module InfluxDB # :nodoc:
2
- VERSION = "0.3.4".freeze
2
+ VERSION = "0.3.5".freeze
3
3
  end
@@ -18,26 +18,54 @@ describe InfluxDB::Client do
18
18
  let(:args) { {} }
19
19
 
20
20
  describe "#create_database" do
21
- before do
22
- stub_request(:get, "http://influxdb.test:9999/query").with(
23
- query: { u: "username", p: "password", q: "CREATE DATABASE foo" }
24
- )
21
+ describe "from param" do
22
+ before do
23
+ stub_request(:get, "http://influxdb.test:9999/query").with(
24
+ query: { u: "username", p: "password", q: "CREATE DATABASE foo" }
25
+ )
26
+ end
27
+
28
+ it "should GET to create a new database" do
29
+ expect(subject.create_database("foo")).to be_a(Net::HTTPOK)
30
+ end
25
31
  end
26
32
 
27
- it "should GET to create a new database" do
28
- expect(subject.create_database("foo")).to be_a(Net::HTTPOK)
33
+ describe "from config" do
34
+ before do
35
+ stub_request(:get, "http://influxdb.test:9999/query").with(
36
+ query: { u: "username", p: "password", q: "CREATE DATABASE database" }
37
+ )
38
+ end
39
+
40
+ it "should GET to create a new database using database name from config" do
41
+ expect(subject.create_database).to be_a(Net::HTTPOK)
42
+ end
29
43
  end
30
44
  end
31
45
 
32
46
  describe "#delete_database" do
33
- before do
34
- stub_request(:get, "http://influxdb.test:9999/query").with(
35
- query: { u: "username", p: "password", q: "DROP DATABASE foo" }
36
- )
47
+ describe "from param" do
48
+ before do
49
+ stub_request(:get, "http://influxdb.test:9999/query").with(
50
+ query: { u: "username", p: "password", q: "DROP DATABASE foo" }
51
+ )
52
+ end
53
+
54
+ it "should GET to remove a database" do
55
+ expect(subject.delete_database("foo")).to be_a(Net::HTTPOK)
56
+ end
37
57
  end
38
58
 
39
- it "should GET to remove a database" do
40
- expect(subject.delete_database("foo")).to be_a(Net::HTTPOK)
59
+ describe "from config" do
60
+ before do
61
+ stub_request(:get, "http://influxdb.test:9999/query").with(
62
+ query: { u: "username", p: "password", q: "DROP DATABASE database" }
63
+ )
64
+ end
65
+
66
+ it "should GET to remove a database using database name from config" do
67
+ expect(subject.delete_database).to be_a(Net::HTTPOK)
68
+ end
41
69
  end
42
70
  end
43
71
 
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.3.4
4
+ version: 0.3.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-06-07 00:00:00.000000000 Z
12
+ date: 2016-06-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json
@@ -192,7 +192,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
192
192
  version: '0'
193
193
  segments:
194
194
  - 0
195
- hash: 4505690428131411783
195
+ hash: -2716499157754774119
196
196
  required_rubygems_version: !ruby/object:Gem::Requirement
197
197
  none: false
198
198
  requirements:
@@ -201,7 +201,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
201
201
  version: '0'
202
202
  segments:
203
203
  - 0
204
- hash: 4505690428131411783
204
+ hash: -2716499157754774119
205
205
  requirements: []
206
206
  rubyforge_project:
207
207
  rubygems_version: 1.8.25