restfully 0.8.1 → 0.8.2
Sign up to get free protection for your applications and to get access to all the features.
@@ -95,7 +95,7 @@ module Restfully
|
|
95
95
|
def retry!
|
96
96
|
if @attempts < @retry_on_error
|
97
97
|
@attempts+=1
|
98
|
-
session.logger.
|
98
|
+
session.logger.warn "Encountered connection or server error. Retrying in #{@wait_before_retry}s... [#{@attempts}/#{@retry_on_error}]"
|
99
99
|
sleep @wait_before_retry if @wait_before_retry > 0
|
100
100
|
execute!
|
101
101
|
else
|
data/lib/restfully/version.rb
CHANGED
@@ -0,0 +1,35 @@
|
|
1
|
+
{
|
2
|
+
"assigned_nodes": [
|
3
|
+
|
4
|
+
],
|
5
|
+
"directory": "/home/dbalouek",
|
6
|
+
"command": "",
|
7
|
+
"mode": "INTERACTIVE",
|
8
|
+
"submitted_at": 1306141519,
|
9
|
+
"project": "default",
|
10
|
+
"events": [
|
11
|
+
|
12
|
+
],
|
13
|
+
"uid": 384886,
|
14
|
+
"user_uid": "dbalouek",
|
15
|
+
"links": [
|
16
|
+
{
|
17
|
+
"href": "/sid/grid5000/sites/rennes/jobs/384886",
|
18
|
+
"rel": "self",
|
19
|
+
"type": "application/vnd.fr.grid5000.api.Job+json;level=1"
|
20
|
+
},
|
21
|
+
{
|
22
|
+
"href": "/sid/grid5000/sites/rennes",
|
23
|
+
"rel": "parent",
|
24
|
+
"type": "application/vnd.fr.grid5000.api.Site+json;level=1"
|
25
|
+
}
|
26
|
+
],
|
27
|
+
"types": [
|
28
|
+
"container"
|
29
|
+
],
|
30
|
+
"queue": "default",
|
31
|
+
"started_at": 1306517400,
|
32
|
+
"scheduled_at": 1306517400,
|
33
|
+
"state": "waiting",
|
34
|
+
"properties": "maintenance = 'NO'"
|
35
|
+
}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
-
describe Restfully::MediaType do
|
4
|
-
|
3
|
+
describe Restfully::MediaType do
|
4
|
+
|
5
5
|
class NewMediaType < Restfully::MediaType::AbstractMediaType
|
6
6
|
set :signature, "application/whatever"
|
7
7
|
set :parser, JSON
|
@@ -35,7 +35,7 @@ describe Restfully::MediaType do
|
|
35
35
|
Restfully::MediaType.register Restfully::MediaType::Grid5000
|
36
36
|
Restfully::MediaType.find('application/vnd.grid5000+json; charset=utf-8').should == Restfully::MediaType::Grid5000
|
37
37
|
end
|
38
|
-
|
38
|
+
|
39
39
|
it "should find the corresponding media_type from the less generic to the most generic [application/json]" do
|
40
40
|
Restfully::MediaType.catalog.clear
|
41
41
|
Restfully::MediaType.register Restfully::MediaType::Wildcard
|
@@ -60,7 +60,7 @@ describe Restfully::MediaType do
|
|
60
60
|
end
|
61
61
|
it "should correctly initialize with a payload" do
|
62
62
|
media_type = Restfully::MediaType::Wildcard.new(
|
63
|
-
"some string",
|
63
|
+
"some string",
|
64
64
|
mock(Restfully::Session)
|
65
65
|
)
|
66
66
|
media_type.property("some").should == "some"
|
@@ -70,7 +70,7 @@ describe Restfully::MediaType do
|
|
70
70
|
|
71
71
|
describe Restfully::MediaType::Grid5000 do
|
72
72
|
before do
|
73
|
-
@session =
|
73
|
+
@session =
|
74
74
|
@media_type = Restfully::MediaType::Grid5000.new(
|
75
75
|
StringIO.new(fixture('grid5000-rennes.json')),
|
76
76
|
@session
|
@@ -85,6 +85,20 @@ describe Restfully::MediaType do
|
|
85
85
|
@media_type.property("uid").should == "rennes"
|
86
86
|
end
|
87
87
|
|
88
|
+
it "should correctly tell if it represents a symbol [uid=string]" do
|
89
|
+
@media_type.represents?(:rennes).should be_true
|
90
|
+
@media_type.represents?(:'whatever').should be_false
|
91
|
+
end
|
92
|
+
|
93
|
+
it "should correctly tell if it represents a symbol [uid=integer]" do
|
94
|
+
@media_type = Restfully::MediaType::Grid5000.new(
|
95
|
+
StringIO.new(fixture('grid5000-rennes-job.json')),
|
96
|
+
@session
|
97
|
+
)
|
98
|
+
@media_type.represents?(:'384886').should be_true
|
99
|
+
@media_type.represents?(:'384887').should be_false
|
100
|
+
end
|
101
|
+
|
88
102
|
it "should tell if it is a collection" do
|
89
103
|
@media_type.collection?.should be_false
|
90
104
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: restfully
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 59
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 8
|
9
|
-
-
|
10
|
-
version: 0.8.
|
9
|
+
- 2
|
10
|
+
version: 0.8.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Cyril Rohr
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-05-
|
18
|
+
date: 2011-05-25 00:00:00 +02:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -217,6 +217,7 @@ files:
|
|
217
217
|
- spec/fixtures/bonfire-network-collection.xml
|
218
218
|
- spec/fixtures/bonfire-network-existing.xml
|
219
219
|
- spec/fixtures/bonfire-root.xml
|
220
|
+
- spec/fixtures/grid5000-rennes-job.json
|
220
221
|
- spec/fixtures/grid5000-rennes-jobs.json
|
221
222
|
- spec/fixtures/grid5000-rennes.json
|
222
223
|
- spec/restfully/collection_spec.rb
|
@@ -278,6 +279,7 @@ test_files:
|
|
278
279
|
- spec/fixtures/bonfire-network-collection.xml
|
279
280
|
- spec/fixtures/bonfire-network-existing.xml
|
280
281
|
- spec/fixtures/bonfire-root.xml
|
282
|
+
- spec/fixtures/grid5000-rennes-job.json
|
281
283
|
- spec/fixtures/grid5000-rennes-jobs.json
|
282
284
|
- spec/fixtures/grid5000-rennes.json
|
283
285
|
- spec/restfully/collection_spec.rb
|