Module: NoaaWeatherClient::SoapService

Included in:
NoaaWeatherClient::Services::ForecastByDay
Defined in:
lib/noaa_weather_client/services/soap_service.rb

Instance Method Summary collapse

Instance Method Details

#object_from_response(soap_action, message, options = {}) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/noaa_weather_client/services/soap_service.rb', line 8

def object_from_response(soap_action, message, options = {})
  client = options.fetch(:client, SoapClientFactory.build_client)
  response_class = options.fetch(:response_class, Responses::GenericResponse)
  response_class.new client.call(soap_action, message: message).body
rescue Savon::Error => e
  raise Errors::CommunicationError, e.message, e.backtrace
end