class DegreeConverter::Converter
Public Class Methods
new()
click to toggle source
# File lib/degree_converter/converter.rb, line 6 def initialize @client = Savon.client do wsdl 'http://www.webservicex.net/ConvertTemperature.asmx?wsdl' convert_request_keys_to :camelcase open_timeout 10 read_timeout 10 log false end end
Public Instance Methods
convert( temperature, from, to )
click to toggle source
# File lib/degree_converter/converter.rb, line 15 def convert( temperature, from, to ) response = @client.call(:convert_temp, message: { temperature: temperature, from_unit: from, to_unit: to }) result = response.body[:convert_temp_response][:convert_temp_result] result end