Commit 553a65df authored by Sanad Liaquat's avatar Sanad Liaquat

Port ee changes

parent 84cb5f13
...@@ -329,6 +329,7 @@ module QA ...@@ -329,6 +329,7 @@ module QA
module Page module Page
autoload :Logging, 'qa/support/page/logging' autoload :Logging, 'qa/support/page/logging'
end end
autoload :Api, 'qa/support/api'
end end
end end
......
...@@ -41,6 +41,7 @@ module QA ...@@ -41,6 +41,7 @@ module QA
private private
include Support::Api
attr_writer :api_resource, :api_response attr_writer :api_resource, :api_response
def resource_web_url(resource) def resource_web_url(resource)
...@@ -82,10 +83,6 @@ module QA ...@@ -82,10 +83,6 @@ module QA
end end
end end
def parse_body(response)
JSON.parse(response.body, symbolize_names: true)
end
def process_api_response(parsed_response) def process_api_response(parsed_response)
self.api_response = parsed_response self.api_response = parsed_response
self.api_resource = transform_api_resource(parsed_response.deep_dup) self.api_resource = transform_api_resource(parsed_response.deep_dup)
...@@ -94,25 +91,6 @@ module QA ...@@ -94,25 +91,6 @@ module QA
def transform_api_resource(api_resource) def transform_api_resource(api_resource)
api_resource api_resource
end end
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
end end
end end
end end
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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment