nsicloudooo 0.2.4 → 0.2.5

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.4
1
+ 0.2.5
@@ -27,7 +27,7 @@ module NSICloudooo
27
27
  sleep seconds-1
28
28
  end
29
29
  {
30
- key: "key for document #{filename}",
30
+ doc_key: "key for document #{filename}",
31
31
  callback: callback,
32
32
  verb: verb,
33
33
  }.to_json
@@ -36,16 +36,17 @@ module NSICloudooo
36
36
  get "/" do
37
37
  content_type :json
38
38
  incoming = JSON.parse(request.body.read)
39
- if incoming["key"].include? "secs"
39
+ if incoming.has_key?("key") && incoming["key"].include?("secs")
40
40
  unless @@done.has_key? incoming["key"]
41
41
  @@done[incoming["key"]] = true
42
42
  return {done: false}.to_json
43
43
  else
44
44
  return {done: true}.to_json
45
45
  end
46
- else
47
- return 404 if incoming["key"].include? "dont"
46
+ elsif incoming.has_key? "doc_key"
47
+ return {:images => [], :files => []}.to_json
48
48
  end
49
+ return 404 if incoming["key"].include? "dont"
49
50
  end
50
51
  end
51
52
 
@@ -55,7 +56,7 @@ module NSICloudooo
55
56
  #
56
57
  # @param [Fixnum] port the port where the fake server will listen
57
58
  # * make sure there's not anything else listenning on this port
58
- def start_server(port=8886)
59
+ def start_server(port=9886)
59
60
  @thread = Thread.new do
60
61
  Server.prepare
61
62
  Server.run! :port => port
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.4"
8
+ s.version = "0.2.5"
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-03-27"
12
+ s.date = "2012-03-29"
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 = [
@@ -6,7 +6,7 @@ $folder = File.expand_path(File.dirname(__FILE__))
6
6
  describe NSICloudooo do
7
7
 
8
8
  before :all do
9
- @nsicloudooo = NSICloudooo::Client.new 'http://test:test@localhost:8886'
9
+ @nsicloudooo = NSICloudooo::Client.new 'http://test:test@localhost:9886'
10
10
  @fake_cloudooo = NSICloudooo::FakeServerManager.new.start_server
11
11
  end
12
12
 
@@ -18,7 +18,7 @@ describe NSICloudooo do
18
18
  it "can send a document to be granulated by a cloudooo node" do
19
19
  response = @nsicloudooo.granulate(:file => 'document', :filename => 'test.odt')
20
20
  response.should_not be_nil
21
- response["key"].should == "key for document test.odt"
21
+ response["doc_key"].should == "key for document test.odt"
22
22
  end
23
23
  end
24
24
 
@@ -26,7 +26,7 @@ describe NSICloudooo do
26
26
  it "can send document in a closed format to be granulated by a cloudooo node" do
27
27
  response = @nsicloudooo.granulate(:file => 'document', :filename => 'test.doc')
28
28
  response.should_not be_nil
29
- response["key"].should == "key for document test.doc"
29
+ response["doc_key"].should == "key for document test.doc"
30
30
  end
31
31
  end
32
32
 
@@ -34,7 +34,7 @@ describe NSICloudooo do
34
34
  it "can download documents from a link to be granulated by a cloudooo node" do
35
35
  response = @nsicloudooo.granulate(:doc_link => "http://doc_link/test.doc")
36
36
  response.should_not be_nil
37
- response["key"].should == "key for document test.doc"
37
+ response["doc_key"].should == "key for document test.doc"
38
38
  end
39
39
  end
40
40
 
@@ -42,24 +42,32 @@ describe NSICloudooo do
42
42
  it "can send a document to be granulated by a cloudooo node and specify a callback url" do
43
43
  response = @nsicloudooo.granulate(:file => 'document', :filename => 'test.odt', :callback => 'http://google.com')
44
44
  response.should_not be_nil
45
- response["key"].should == "key for document test.odt"
45
+ response["doc_key"].should == "key for document test.odt"
46
46
  response["callback"].should == 'http://google.com'
47
47
  end
48
48
 
49
49
  it "can send a document to be granulated by a cloudooo node and specify the verb" do
50
50
  response = @nsicloudooo.granulate(:file => 'document', :filename => 'test.odt', :callback => 'http://google.com', :verb => 'PUT')
51
51
  response.should_not be_nil
52
- response["key"].should == "key for document test.odt"
52
+ response["doc_key"].should == "key for document test.odt"
53
53
  response["callback"].should == 'http://google.com'
54
54
  response["verb"].should == 'PUT'
55
55
  end
56
56
  end
57
57
 
58
58
  context "verify granulation" do
59
- it "can verify is a granulation is done or no" do
60
- key = @nsicloudooo.granulate(:file => 'document', :filename => '2secs.odt')["key"]
59
+ it "can verify is a granulation is done or not" do
60
+ key = @nsicloudooo.granulate(:file => 'document', :filename => '2secs.odt')["doc_key"]
61
61
  @nsicloudooo.done(key)["done"].should be_false
62
62
  @nsicloudooo.done(key)["done"].should be_true
63
+ @nsicloudooo.grains_keys_for(key)["images"].should have(0).images
64
+ @nsicloudooo.grains_keys_for(key)["files"].should have(0).files
65
+ end
66
+
67
+ it "can access the keys for all its grains" do
68
+ key = @nsicloudooo.granulate(:file => 'document', :filename => '2secs.odt')["doc_key"]
69
+ @nsicloudooo.grains_keys_for(key)["images"].should have(0).images
70
+ @nsicloudooo.grains_keys_for(key)["files"].should have(0).files
63
71
  end
64
72
 
65
73
  it "raises an error whentrying to verify if non-existing key is done" do
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
4
+ version: 0.2.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-27 00:00:00.000000000 Z
12
+ date: 2012-03-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sinatra
16
- requirement: &70181469278700 !ruby/object:Gem::Requirement
16
+ requirement: &70340525408860 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70181469278700
24
+ version_requirements: *70340525408860
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: rspec
27
- requirement: &70181469277380 !ruby/object:Gem::Requirement
27
+ requirement: &70340525407280 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 2.8.0
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70181469277380
35
+ version_requirements: *70340525407280
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: yard
38
- requirement: &70181469275980 !ruby/object:Gem::Requirement
38
+ requirement: &70340525406160 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0.7'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70181469275980
46
+ version_requirements: *70340525406160
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: rdoc
49
- requirement: &70181469273960 !ruby/object:Gem::Requirement
49
+ requirement: &70340525404460 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '3.12'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70181469273960
57
+ version_requirements: *70340525404460
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: bundler
60
- requirement: &70181469382000 !ruby/object:Gem::Requirement
60
+ requirement: &70340525646560 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 1.1.0
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70181469382000
68
+ version_requirements: *70340525646560
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: jeweler
71
- requirement: &70181469379960 !ruby/object:Gem::Requirement
71
+ requirement: &70340525645560 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ~>
@@ -76,7 +76,7 @@ dependencies:
76
76
  version: 1.8.3
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70181469379960
79
+ version_requirements: *70340525645560
80
80
  description: A simple gem to access a nsi.cloudooo node
81
81
  email: d.camata@gmail.com
82
82
  executables: []
@@ -114,7 +114,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
114
114
  version: '0'
115
115
  segments:
116
116
  - 0
117
- hash: 4594306514646020446
117
+ hash: -2903060845533414098
118
118
  required_rubygems_version: !ruby/object:Gem::Requirement
119
119
  none: false
120
120
  requirements: