almapi 0.1.9 → 0.1.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/almapi/almapi.rb +7 -6
- data/lib/almapi/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a2c71796da8723be199a4befd1fc46e4df4e6f1fc718979982cee53f201302e9
|
4
|
+
data.tar.gz: 55c28ae9525298ab9af58716ac1d705860c96ea7244bd4e6725a752ee9da233f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 941deaa4377e68d206081d46c99df0ee2eb35b3dd57d90f2f81518da97264d5c0173f9fa3ea15b4d5679ed698cd9defc18113afa73f4a1d272081d28c3f5cdaa
|
7
|
+
data.tar.gz: c3d3ba08d5f450ee06c5f0a0ea360e9128b7446974a5187e0dd6ed666c807ea7ba544635a1348777d954cbd866faff27daa720c552639f6c30f38ddb4bbf5f21
|
data/lib/almapi/almapi.rb
CHANGED
@@ -62,7 +62,7 @@ module Almapi
|
|
62
62
|
end
|
63
63
|
|
64
64
|
puts "[Almapi::Api.get] INFO URL #{url_api}"
|
65
|
-
handle_response(@conn.get(url_api))
|
65
|
+
handle_response(@conn.get(url_api), "GET")
|
66
66
|
end
|
67
67
|
|
68
68
|
# Handles a POST request creating the complete URI.
|
@@ -74,7 +74,7 @@ module Almapi
|
|
74
74
|
def post(resource, data)
|
75
75
|
url_api = "#{@uri_base}#{resource}"
|
76
76
|
puts "[Almapi::Api.post] INFO URL #{url_api}"
|
77
|
-
handle_response(@conn.post(url_api, data.to_s))
|
77
|
+
handle_response(@conn.post(url_api, data.to_s), "POST")
|
78
78
|
end
|
79
79
|
|
80
80
|
# Handles a PUT request creating the complete URI.
|
@@ -86,7 +86,7 @@ module Almapi
|
|
86
86
|
def put(resource, data)
|
87
87
|
url_api = "#{@uri_base}#{resource}"
|
88
88
|
puts "[Almapi::Api.put] INFO URL #{url_api}"
|
89
|
-
handle_response(@conn.put(url_api, data.to_s))
|
89
|
+
handle_response(@conn.put(url_api, data.to_s), "PUT")
|
90
90
|
end
|
91
91
|
|
92
92
|
# Handles a DELETE request creating the complete URI.
|
@@ -95,10 +95,10 @@ module Almapi
|
|
95
95
|
# Must not include "?" for it adds "?apikey" automatically.
|
96
96
|
# @param data [String] : an XML string containing data to put.
|
97
97
|
# @return [Response] : the resulting response. If error occurs, raises an AlmapiError
|
98
|
-
def delete(resource,
|
98
|
+
def delete(resource, data)
|
99
99
|
url_api = "#{@uri_base}#{resource}"
|
100
100
|
puts "[Almapi::Api.delete] INFO URL #{url_api}"
|
101
|
-
handle_response(@conn.delete(url_api))
|
101
|
+
handle_response(@conn.delete(url_api), "DELETE")
|
102
102
|
end
|
103
103
|
|
104
104
|
private
|
@@ -115,7 +115,8 @@ module Almapi
|
|
115
115
|
response
|
116
116
|
else
|
117
117
|
# Request has been correctly handled but cannot succeed
|
118
|
-
raise Almapi::AlmapiError,
|
118
|
+
raise Almapi::AlmapiError,
|
119
|
+
"[Almapi::Api.handle_response] AlmapiError : for method #{method}, #{response.status} -> #{response.body}"
|
119
120
|
end
|
120
121
|
end
|
121
122
|
end
|
data/lib/almapi/version.rb
CHANGED