lib/business_central/object/request.rb in business-central-1.0.2 vs lib/business_central/object/request.rb in business-central-1.0.3
- old
+ new
@@ -40,11 +40,11 @@
end
def self.convert(request = {})
result = {}
request.each do |key, value|
- result[key.to_s.to_camel_case] = value
+ result[key.to_s.to_camel_case] = value if key.is_a? Symbol
end
return result.to_json
end
@@ -59,10 +59,10 @@
return true
else
if Response.unauthorized?(request.code.to_i)
raise UnauthorizedException.new
else
- if !response[:error][:code].blank?
+ if !response.fetch(:error, nil).nil?
case response[:error][:code]
when 'Internal_CompanyNotFound'
raise CompanyNotFoundException.new
else
raise ApiException.new("#{request.code} - #{response[:error][:code]} #{response[:error][:message]}")
\ No newline at end of file