nsicloudooo 0.2.8 → 0.2.9
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.
- data/VERSION +1 -1
- data/lib/nsicloudooo/client.rb +14 -9
- data/lib/nsicloudooo/errors.rb +3 -0
- data/nsicloudooo.gemspec +2 -2
- data/spec/nsicloudooo_spec.rb +8 -0
- metadata +3 -3
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.2.
|
|
1
|
+
0.2.9
|
data/lib/nsicloudooo/client.rb
CHANGED
|
@@ -136,16 +136,21 @@ module NSICloudooo
|
|
|
136
136
|
end
|
|
137
137
|
|
|
138
138
|
def execute_request(request)
|
|
139
|
-
|
|
140
|
-
http
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
raise NSICloudooo::Errors::Client::
|
|
139
|
+
begin
|
|
140
|
+
response = Net::HTTP.start @url, @port do |http|
|
|
141
|
+
http.request(request)
|
|
142
|
+
end
|
|
143
|
+
rescue Errno::ECONNREFUSED => e
|
|
144
|
+
raise NSICloudooo::Errors::Client::ConnectionRefusedError
|
|
145
|
+
else
|
|
146
|
+
raise NSICloudooo::Errors::Client::KeyNotFoundError if response.code == "404"
|
|
147
|
+
raise NSICloudooo::Errors::Client::MalformedRequestError if response.code == "400"
|
|
148
|
+
raise NSICloudooo::Errors::Client::AuthenticationError if response.code == "401"
|
|
149
|
+
if response.code == "500" and response.body.include?("SAM")
|
|
150
|
+
raise NSICloudooo::Errors::Client::SAMConnectionError
|
|
151
|
+
end
|
|
152
|
+
JSON.parse(response.body)
|
|
147
153
|
end
|
|
148
|
-
JSON.parse(response.body)
|
|
149
154
|
end
|
|
150
155
|
end
|
|
151
156
|
end
|
data/lib/nsicloudooo/errors.rb
CHANGED
data/nsicloudooo.gemspec
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |s|
|
|
7
7
|
s.name = "nsicloudooo"
|
|
8
|
-
s.version = "0.2.
|
|
8
|
+
s.version = "0.2.9"
|
|
9
9
|
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
11
11
|
s.authors = ["Douglas Camata"]
|
|
12
|
-
s.date = "2012-04-
|
|
12
|
+
s.date = "2012-04-28"
|
|
13
13
|
s.description = "A simple gem to access a nsi.cloudooo node"
|
|
14
14
|
s.email = "d.camata@gmail.com"
|
|
15
15
|
s.extra_rdoc_files = [
|
data/spec/nsicloudooo_spec.rb
CHANGED
|
@@ -14,6 +14,14 @@ describe NSICloudooo do
|
|
|
14
14
|
@fake_cloudooo.stop_server
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
+
context "cannot connect to the server" do
|
|
18
|
+
it "throws error if couldn't connec to the server" do
|
|
19
|
+
nsicloudooo = NSICloudooo::Client.new 'http://test:test@localhost:4000'
|
|
20
|
+
expect { nsicloudooo.granulate(:file => 'document', :filename => "teste.odt") }.to \
|
|
21
|
+
raise_error(NSICloudooo::Errors::Client::ConnectionRefusedError)
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
|
|
17
25
|
context "simple granulation" do
|
|
18
26
|
it "can send a document to be granulated by a cloudooo node" do
|
|
19
27
|
response = @nsicloudooo.granulate(:file => 'document', :filename => 'test.odt')
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: nsicloudooo
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.9
|
|
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: 2012-04-
|
|
12
|
+
date: 2012-04-28 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: sinatra
|
|
@@ -144,7 +144,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
144
144
|
version: '0'
|
|
145
145
|
segments:
|
|
146
146
|
- 0
|
|
147
|
-
hash:
|
|
147
|
+
hash: 1769661169347116718
|
|
148
148
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
149
149
|
none: false
|
|
150
150
|
requirements:
|