Module: JustimmoClient::V1::JustimmoRequest Private
- Includes:
- Logging
- Included in:
- EmployeeRequest, RealtyRequest
- Defined in:
- lib/justimmo_client/api/v1/requests/justimmo_request.rb
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Instance Method Summary collapse
- #get(path, params = {}) ⇒ Object private
- #request(path, params = {}) ⇒ Object private
- #with_request_error_handler ⇒ Object private
Methods included from Logging
default_logger, #logger, rails_logger
Instance Method Details
#get(path, params = {}) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
12 13 14 |
# File 'lib/justimmo_client/api/v1/requests/justimmo_request.rb', line 12 def get(path, params = {}) request(path, params) end |
#request(path, params = {}) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/justimmo_client/api/v1/requests/justimmo_request.rb', line 16 def request(path, params = {}) uri = "#{JustimmoClient::Config.url}/#{path}" = { params: params, Authorization: "Basic #{JustimmoClient::Config.credentials}" } Retriable.retriable do with_request_error_handler do log.debug("Requesting #{uri} with params #{[:params]}") RestClient.proxy = JustimmoClient::Config.proxy log.debug("Using proxy: #{RestClient.proxy}") if RestClient.proxy response = RestClient.get(uri, ) response.body end end end |
#with_request_error_handler ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
35 36 37 38 39 40 41 42 |
# File 'lib/justimmo_client/api/v1/requests/justimmo_request.rb', line 35 def with_request_error_handler yield rescue RestClient::Unauthorized log.error("Authentication failed, check your configuration.") raise JustimmoClient::AuthenticationFailed rescue RestClient::Exception, SocketError, Errno::ECONNREFUSED => e raise JustimmoClient::RetrievalFailed, e end |