lib/promoter/request.rb in promoter-0.9.3 vs lib/promoter/request.rb in promoter-0.9.4
- old
+ new
@@ -6,23 +6,29 @@
class Request
include HTTParty
extend Errors
+ def self.delete(url)
+ response = HTTParty.delete(url, headers: auth_header)
+ parse_response(response)
+ end
+
def self.get(url)
response = HTTParty.get(url, headers: auth_header)
parse_response(response)
end
- def self.post(url, params)
+ def self.put(url, params)
response_format = params.delete(:response_format) || :json
- response = HTTParty.post(url, body: params.to_json, headers: auth_header)
+ response = HTTParty.put(url, body: params.to_json, headers: auth_header)
parse_response(response, response_format)
end
- def self.delete(url)
- response = HTTParty.delete(url, headers: auth_header)
- parse_response(response)
+ def self.post(url, params)
+ response_format = params.delete(:response_format) || :json
+ response = HTTParty.post(url, body: params.to_json, headers: auth_header)
+ parse_response(response, response_format)
end
private
def self.parse_response(response, response_format=:json)