almapi 0.1.9 → 0.1.11
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 +6 -5
- 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: 659c6f0d7342d76965200cc2d28add619ff58cb622e66d6e41878dc553110a52
|
4
|
+
data.tar.gz: bc884081477e70ae1d4bea869962f825c427171042ec03cdafdf9045010b5360
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 87ab1b72ea1bc7a18631f52d04ccff68c5e68e967b7c073b4b9bb70df9223a39299f3bf9ba97650276bf1275c79299b0088d2162f611fa65ebbc2a85688a0ef9
|
7
|
+
data.tar.gz: 9f87ad03a87626b9560c01720c5937f4bb85494dfbf3252c8aa357603988ff70f52c3479a7c9ff0c2b77356e53139abea7a09e7ffc8a90c611d889bdf94c8370
|
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.
|
@@ -98,7 +98,7 @@ module Almapi
|
|
98
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