Class: SysLibDetector::WebServiceCommunicator
- Inherits:
-
Object
- Object
- SysLibDetector::WebServiceCommunicator
- Defined in:
- lib/sys_lib_detector/web_service_communicator.rb
Overview
Handler for the communication with the web-service for retrieving the required system libraries
Constant Summary collapse
- SERVICE_URL =
Url for the web-service libraries retrieval endpoint
"https://sys-libraries.herokuapp.com/libraries"
Instance Method Summary collapse
-
#initialize ⇒ WebServiceCommunicator
constructor
Initializing the handler object, with a check for internet connectivity.
-
#retrieve_sys_libraries(gems_names, os_name) ⇒ Json
Retrieving the required system libraries by sending a get request to the web-service with the gems’ names and running operating system.
Constructor Details
#initialize ⇒ WebServiceCommunicator
Initializing the handler object, with a check for internet connectivity
12 13 14 15 16 17 |
# File 'lib/sys_lib_detector/web_service_communicator.rb', line 12 def initialize # checking internet connectivity raise Exception::NoInternetConnection if ping != :pong @url = SERVICE_URL end |
Instance Method Details
#retrieve_sys_libraries(gems_names, os_name) ⇒ Json
Retrieving the required system libraries by sending a get request to the web-service with the gems’ names and running operating system
25 26 27 28 29 30 31 |
# File 'lib/sys_lib_detector/web_service_communicator.rb', line 25 def retrieve_sys_libraries(gems_names, os_name) params = { gems: gems_names, os: os_name } response = JSON.parse(RestClient.get(@url, {params: params})) end |