rocking_chair 0.2.4 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rocking_chair/http_adapter.rb +15 -15
- metadata +3 -3
@@ -16,46 +16,46 @@ module RockingChair
|
|
16
16
|
|
17
17
|
def get(uri, headers=nil)
|
18
18
|
result = http_adapter.get(uri)
|
19
|
-
if result.is_a?(
|
20
|
-
result
|
21
|
-
else
|
19
|
+
if result.is_a?(String)
|
22
20
|
JSON.parse(result)
|
21
|
+
else
|
22
|
+
result
|
23
23
|
end
|
24
24
|
end
|
25
25
|
|
26
26
|
def post(uri, payload, headers=nil)
|
27
27
|
result = http_adapter.post(uri, payload)
|
28
|
-
if result.is_a?(
|
29
|
-
result
|
30
|
-
else
|
28
|
+
if result.is_a?(String)
|
31
29
|
JSON.parse(result)
|
30
|
+
else
|
31
|
+
result
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
35
|
def put(uri, payload=nil, headers=nil)
|
36
36
|
result = http_adapter.put(uri, payload)
|
37
|
-
if result.is_a?(
|
38
|
-
result
|
39
|
-
else
|
37
|
+
if result.is_a?(String)
|
40
38
|
JSON.parse(result)
|
39
|
+
else
|
40
|
+
result
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
44
|
def delete(uri, headers=nil)
|
45
45
|
result = http_adapter.delete(uri)
|
46
|
-
if result.is_a?(
|
47
|
-
result
|
48
|
-
else
|
46
|
+
if result.is_a?(String)
|
49
47
|
JSON.parse(result)
|
48
|
+
else
|
49
|
+
result
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
53
|
def copy(uri, destination)
|
54
54
|
result = http_adapter.copy(uri, default_headers.merge('Destination' => destination))
|
55
|
-
if result.is_a?(
|
56
|
-
result
|
57
|
-
else
|
55
|
+
if result.is_a?(String)
|
58
56
|
JSON.parse(result)
|
57
|
+
else
|
58
|
+
result
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rocking_chair
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 29
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 5
|
10
|
+
version: 0.2.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Jonathan Weiss
|