etcdv3 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 75807467bdd1513403f3926bbc48594773e19dc8
4
- data.tar.gz: 2eb2f01abea23cdf81e34f0fc5345b2a06483260
3
+ metadata.gz: 79843ce217e4f7209283fe46c64022d31e491586
4
+ data.tar.gz: 48d9410cc3f1e104b30807476156d65ee09c610b
5
5
  SHA512:
6
- metadata.gz: 8e0a57ecd3958ac63e83ea613711bd10d9a8bf046c6bf89f65cb3a081c2af6b23385c6f4a807516e65ccb5e32f0d76ec46fd6ccc82acc89460d1342123477e8a
7
- data.tar.gz: f4f0f70328822f98cb9cdfa3dd2e5bedcdb47e07b48884dacca011d895af7ee1674338ccfe1faaf697f44a0990921d9ab63aef1768f3916d3574f972757b3adb
6
+ metadata.gz: 2c3f62df6f498ae227744f16eccd24de9939a6e4604dbcbb800b9befabdb45110ca6ae37777bafeb93e09237d29082a6f38a029f6b74e7b525b14bbc58919195
7
+ data.tar.gz: 1098a189e5b130f365090c1eea96869e2f735c77f6129f821c101077036fe95ce4e25d6f627bf5857ca28efad66a0288e62dcf79d812b79d8a8bbd45eb5ff42d
data/README.md CHANGED
@@ -20,13 +20,13 @@ gem install etcdv3
20
20
  require 'etcdv3'
21
21
 
22
22
  # Insecure connection
23
- conn = Etcd.new(url: 'http://127.0.0.1:2379')
23
+ conn = Etcdv3.new(url: 'http://127.0.0.1:2379')
24
24
 
25
25
  # Secure connection using default certificates
26
- conn = Etcd.new(url: 'https://hostname:port')
26
+ conn = Etcdv3.new(url: 'https://hostname:port')
27
27
 
28
28
  # Secure connection with Auth
29
- conn = Etcd.new(url: 'https://hostname:port', user: "gary", password: "secret")
29
+ conn = Etcdv3.new(url: 'https://hostname:port', user: "gary", password: "secret")
30
30
 
31
31
  # Secure connection specifying own certificates
32
32
  # Coming soon...
@@ -104,7 +104,7 @@ conn.disable_auth
104
104
  conn.grant_lease(100)
105
105
 
106
106
  # Attach key to lease
107
- conn.put("testkey", "testvalue", lease: 1234566789)
107
+ conn.put("testkey", "testvalue", lease_id: 1234566789)
108
108
 
109
109
  # Get information about lease and its attached keys
110
110
  conn.lease_ttl(1234566789)
@@ -1,3 +1,3 @@
1
1
  class Etcdv3
2
- VERSION = '0.3.0'.freeze
2
+ VERSION = '0.3.1'.freeze
3
3
  end
data/lib/etcdv3.rb CHANGED
@@ -97,7 +97,12 @@ class Etcdv3
97
97
  request.handle(:kv, 'get', [key, opts])
98
98
  end
99
99
 
100
- # Grant a lease with a speified TTL
100
+ # Deletes a specified key
101
+ def del(key, range_end: '')
102
+ request.handle(:kv, 'del', [key, range_end])
103
+ end
104
+
105
+ # Grant a lease with a specified TTL
101
106
  def grant_lease(ttl)
102
107
  request.handle(:lease, 'grant_lease', [ttl])
103
108
  end
data/spec/etcdv3_spec.rb CHANGED
@@ -77,6 +77,22 @@ describe Etcdv3 do
77
77
  it { is_expected.to_not be_nil }
78
78
  end
79
79
 
80
+ describe '#del' do
81
+ context 'no range' do
82
+ before { conn.put('test', 'value') }
83
+ subject { conn.del('test') }
84
+ it { is_expected.to_not be_nil }
85
+ end
86
+ context 'ranged del' do
87
+ before do
88
+ conn.put('test', 'value')
89
+ conn.put('testt', 'value')
90
+ end
91
+ subject { conn.del('test', range_end: 'testtt') }
92
+ it { is_expected.to_not be_nil }
93
+ end
94
+ end
95
+
80
96
  describe '#grant_lease' do
81
97
  subject { conn.grant_lease(2) }
82
98
  it { is_expected.to_not be_nil }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: etcdv3
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shaun Davis