@@ -19,6 +19,7 @@ class RemoteHTTPDataService
19
19
GET_REQUEST = 'GET'
20
20
POST_REQUEST = 'POST'
21
21
DELETE_REQUEST = 'DELETE'
22
+ PUT_REQUEST = 'PUT'
22
23
23
24
#
24
25
# @param [String] endpoint A valid http or https URL. Cannot be nil
@@ -82,6 +83,19 @@ def delete_data(path, data_hash, query = nil)
82
83
make_request ( DELETE_REQUEST , path , data_hash , query )
83
84
end
84
85
86
+ #
87
+ # Send PUT request to store data for the specified resource at the HTTP endpoint
88
+ #
89
+ # @param path - The URI path to send the request
90
+ # @param data_hash - A hash representation of the object to be stored. Cannot be nil or empty.
91
+ # @param query - A hash representation of the URI query data. Key-value pairs will be URL-encoded.
92
+ #
93
+ # @return A wrapped response (ResponseWrapper), see below.
94
+ #
95
+ def put_data ( path , data_hash , query = nil )
96
+ make_request ( PUT_REQUEST , path , data_hash , query )
97
+ end
98
+
85
99
#
86
100
# Make the specified request_type
87
101
#
@@ -106,6 +120,8 @@ def make_request(request_type, path, data_hash = nil, query = nil)
106
120
request = Net ::HTTP ::Post . new ( uri . request_uri )
107
121
when DELETE_REQUEST
108
122
request = Net ::HTTP ::Delete . new ( uri . request_uri )
123
+ when PUT_REQUEST
124
+ request = Net ::HTTP ::Put . new ( uri . request_uri )
109
125
else
110
126
raise Exception , 'A request_type must be specified'
111
127
end
0 commit comments