lib/messenger/bot/request.rb in messenger-bot-1.0.2 vs lib/messenger/bot/request.rb in messenger-bot-1.0.3

- old
+ new

@@ -29,8 +29,24 @@ return { ret: body["error"].nil?, body: body } rescue => e raise e end end + + def self.delete(url, data) + url = URI.parse(url) + http = Net::HTTP.new(url.host, 443) + http.use_ssl = true + begin + request = Net::HTTP::Delete.new(url.request_uri) + request["Content-Type"] = "application/json" + request.body = data.to_json + response = http.request(request) + body = JSON(response.body) + return { ret: body["error"].nil?, body: body } + rescue => e + raise e + end + end end end end