roozer_client 0.5 → 0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/CHANGELOG +1 -0
- data/README +4 -1
- data/lib/roozer_client.rb +9 -0
- data/roozer_client.gemspec +2 -2
- data/test/test_all.rb +26 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
N2I3YzMwNTk0NWRlOTZmMmQyYWFhNTg3Njc2NTQyYWFiYmQ4MmVjZQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YWYzMjE3NDI5MzdkZDc3MmZhNGM3YjFlOTJkNWM2NTFjZDg2YzA2ZA==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
ODIxNjgxZWExNzBmMzU2N2U3MDM3YzIxNzcyNzA0MDM1OGZmYjljNDI0Njdl
|
10
|
+
YzZmYjExYTZlY2IxMWQ3MzVhNGI4Njk5NGE2NWQwMDAyOWI3MjQ3Zjg5YTll
|
11
|
+
ODM0YjZjZGRjMTA0YmNiYzM1Yjk4NmM2ZWRjZDQ4OTFjMWUxNDU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
N2U0ZTQzZDJmM2UyNTU0MzcxNjBlZDVmMDE1Zjc1YzEwYmUzNzlmMzczZTQ4
|
14
|
+
MThhMzMwMzhiNWM5OTE4OTRkZWE4Yzg4NDkzNDk2Yjk5ZGZlOTk1MzZkMjIy
|
15
|
+
MTVhYmQzNDYwODgxODZhYjA4MGNmOTQ1M2U4Y2YyNjQ2NjYzYjM=
|
data/CHANGELOG
CHANGED
data/README
CHANGED
data/lib/roozer_client.rb
CHANGED
@@ -35,6 +35,15 @@ class RoozerClient
|
|
35
35
|
end
|
36
36
|
alias :[]= :put
|
37
37
|
|
38
|
+
def delete(path)
|
39
|
+
request(:delete, path)
|
40
|
+
end
|
41
|
+
|
42
|
+
def update(path, data)
|
43
|
+
existing_data = get(path) rescue nil
|
44
|
+
put(path, data) unless existing_data == data
|
45
|
+
end
|
46
|
+
|
38
47
|
def request(method, path, data=nil)
|
39
48
|
begin
|
40
49
|
url = @urls.first
|
data/roozer_client.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "roozer_client"
|
5
|
-
s.version = "0.
|
5
|
+
s.version = "0.6"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Andrew Snow"]
|
9
|
-
s.date = "2013-
|
9
|
+
s.date = "2013-04-11"
|
10
10
|
s.description = "Ruby client for Roozer server"
|
11
11
|
s.email = "andrew@modulus.org"
|
12
12
|
s.extra_rdoc_files = ["CHANGELOG", "README", "lib/roozer_client.rb"]
|
data/test/test_all.rb
CHANGED
@@ -32,6 +32,18 @@ class TestRoozerClient < Test::Unit::TestCase
|
|
32
32
|
assert_equal datahash, result
|
33
33
|
end
|
34
34
|
|
35
|
+
def test_delete
|
36
|
+
result = nil
|
37
|
+
datahash = {'a' => 'b'}
|
38
|
+
response = accept_request(204, '') do
|
39
|
+
@client.delete('sub1')
|
40
|
+
end
|
41
|
+
assert response
|
42
|
+
assert_equal 'DELETE', response.request_method
|
43
|
+
assert_equal '/test/sub1', response.path
|
44
|
+
end
|
45
|
+
|
46
|
+
|
35
47
|
def test_put
|
36
48
|
response = accept_request(204, '') do
|
37
49
|
@client.put('sub2', x1: 'x2')
|
@@ -42,6 +54,7 @@ class TestRoozerClient < Test::Unit::TestCase
|
|
42
54
|
assert_equal '{"value":{"x1":"x2"}}', response.body
|
43
55
|
end
|
44
56
|
|
57
|
+
|
45
58
|
def test_get_404
|
46
59
|
result = nil
|
47
60
|
response = accept_request(404, {error: 'not found'}.to_json) do
|
@@ -52,6 +65,19 @@ class TestRoozerClient < Test::Unit::TestCase
|
|
52
65
|
assert_nil result
|
53
66
|
end
|
54
67
|
|
68
|
+
def test_update_same
|
69
|
+
result = nil
|
70
|
+
datahash = {'a' => 'b'}
|
71
|
+
response = accept_request(200, {name:"/test/sub1",type:"file",value:datahash}.to_json) do
|
72
|
+
result = @client.update('sub1', datahash)
|
73
|
+
end
|
74
|
+
assert response
|
75
|
+
assert_equal 'GET', response.request_method
|
76
|
+
assert_equal '/test/sub1', response.path
|
77
|
+
assert_equal nil, result
|
78
|
+
end
|
79
|
+
|
80
|
+
|
55
81
|
# def test_failover
|
56
82
|
# @client = RoozerClient.new(url: "http://127.0.0.1:7997;#{@url}", path: 'test')
|
57
83
|
# test_list
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: roozer_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.6'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Snow
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-04-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
type: :runtime
|