roozer_client 0.6 → 0.7
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 +8 -8
- data/CHANGELOG +1 -0
- data/lib/roozer_client.rb +6 -2
- data/roozer_client.gemspec +2 -2
- data/test/test_all.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MmNkOGEyOGRhMGU4NTYzNDNiMWIyOGM0YzhmMDU2ODA1NzUwOGMzNg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YmJkYjYyOWVhNjQyZjk0NzI0OGEyODdkOGE1OTc1MmVmNTliNTE0Ng==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NTNkMzY5N2U2ZDBhMWY0YTY1NDYwNmUyODFjMjE2YzFlZWEzNzlkYWVmZTNj
|
10
|
+
NmUwNzEwN2QwZTllNTMwMWFlOTI2NzU4ODBiNzdkMDBmNzY5MjJmZjEzZDJi
|
11
|
+
MjcxZDI5NGMzYjNhZmRjMzMzZWIyYjZiNjZiZTM4NmQzNWU3MmQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MGU3NmI2NDE4MzIxYTRiMWY5M2NkYTUxN2Q3ZDdiNDk0YzBlYmE0YjI1MmRj
|
14
|
+
ZTUzNTlhOTk3ZDQyNTI4MDdjMjI5ZTE5MzVjNDZjN2U2MzljNGQ3MTIxZjQ3
|
15
|
+
YjU5MDUwNzI5YTUwODAzZDEzZWZjNDgzNGQ0ZjhhMTE5MDk0MWI=
|
data/CHANGELOG
CHANGED
data/lib/roozer_client.rb
CHANGED
@@ -41,7 +41,11 @@ class RoozerClient
|
|
41
41
|
|
42
42
|
def update(path, data)
|
43
43
|
existing_data = get(path) rescue nil
|
44
|
-
put(path, data) unless existing_data == data
|
44
|
+
put(path, data) unless data && existing_data == JSON.parse(data.to_json)
|
45
|
+
end
|
46
|
+
|
47
|
+
def self.data_to_json(data)
|
48
|
+
{value: data}.to_json if data
|
45
49
|
end
|
46
50
|
|
47
51
|
def request(method, path, data=nil)
|
@@ -49,7 +53,7 @@ class RoozerClient
|
|
49
53
|
url = @urls.first
|
50
54
|
resource = RestClient::Resource.new(url, @opts)
|
51
55
|
fullpath = [@path,path].compact.map(&:to_s).join('/')
|
52
|
-
response = resource["/#{fullpath}"].send(method, *[(
|
56
|
+
response = resource["/#{fullpath}"].send(method, *[self.class.data_to_json(data), {content_type: :json, accept: :json}].compact)
|
53
57
|
JSON.parse(response) rescue {}
|
54
58
|
rescue SystemCallError, RestClient::RequestTimeout, RestClient::ServerBrokeConnection, RestClient::InternalServerError
|
55
59
|
puts "#{$!.class}, retrying..."
|
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.7"
|
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-04-
|
9
|
+
s.date = "2013-04-19"
|
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
@@ -67,7 +67,7 @@ class TestRoozerClient < Test::Unit::TestCase
|
|
67
67
|
|
68
68
|
def test_update_same
|
69
69
|
result = nil
|
70
|
-
datahash = {'a' =>
|
70
|
+
datahash = {'a' => 1}
|
71
71
|
response = accept_request(200, {name:"/test/sub1",type:"file",value:datahash}.to_json) do
|
72
72
|
result = @client.update('sub1', datahash)
|
73
73
|
end
|
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.7'
|
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-04-
|
11
|
+
date: 2013-04-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
type: :runtime
|