diff --git a/lib/vindata/services/nada.rb b/lib/vindata/services/nada.rb index 1e360f9..1c30e79 100644 --- a/lib/vindata/services/nada.rb +++ b/lib/vindata/services/nada.rb @@ -69,6 +69,7 @@ def get_client end def get_region_by_state(state) + tries ||= 2 client = get_client data = client.call(:get_region_by_state_code, message: { 'l_Request' => { 'Token' => get_token, @@ -79,6 +80,9 @@ def get_region_by_state(state) } ) data.to_hash[:get_region_by_state_code_response][:get_region_by_state_code_result] + rescue Savon::SOAPFault => error + retry if (tries -= 1) > 0 + raise error.message end def details_by_vin(vin) @@ -110,6 +114,8 @@ def get_acv(data) client = get_client begin + tries ||= 2 + data = client.call(:get_default_vehicle_and_value_by_vin, message: { 'vehicleRequest' => { 'Token' => token, @@ -132,6 +138,7 @@ def get_acv(data) rescue Savon::SOAPFault => error return false if error.message.include? 'No vehicle found' + retry if (tries -= 1) > 0 raise error.message end end diff --git a/lib/vindata/version.rb b/lib/vindata/version.rb index c4e018e..4353830 100644 --- a/lib/vindata/version.rb +++ b/lib/vindata/version.rb @@ -1,3 +1,3 @@ module VinData - VERSION = '0.0.4' + VERSION = '0.0.5' end