diff options
Diffstat (limited to 'qa/qa/support/api.rb')
-rw-r--r-- | qa/qa/support/api.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/qa/qa/support/api.rb b/qa/qa/support/api.rb new file mode 100644 index 00000000000..1107d43161e --- /dev/null +++ b/qa/qa/support/api.rb @@ -0,0 +1,28 @@ +module QA + module Support + module Api + def post(url, payload) + RestClient::Request.execute( + method: :post, + url: url, + payload: payload, + verify_ssl: false) + rescue RestClient::ExceptionWithResponse => e + e.response + end + + def get(url) + RestClient::Request.execute( + method: :get, + url: url, + verify_ssl: false) + rescue RestClient::ExceptionWithResponse => e + e.response + end + + def parse_body(response) + JSON.parse(response.body, symbolize_names: true) + end + end + end +end |