From 1bbda3054602f9d6fd059aa888ea9b4a069d630d Mon Sep 17 00:00:00 2001 From: Cody Caughlan Date: Wed, 11 Jun 2014 14:14:38 -0700 Subject: [PATCH] Boolean responses are coming back from QB as lowercase ("true") but the BOOL_CAST type was only comparing against uppercase ("True"). Either case is valid --- lib/qbxml/types.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/qbxml/types.rb b/lib/qbxml/types.rb index 6e99682..47a2e5d 100644 --- a/lib/qbxml/types.rb +++ b/lib/qbxml/types.rb @@ -1,12 +1,12 @@ module Qbxml::Types - XML_DIRECTIVES = { + XML_DIRECTIVES = { :qb => [:qbxml, { version: '7.0' }], :qbpos => [:qbposxml, { version: '3.0' }] }.freeze FLOAT_CAST = Proc.new {|d| d ? Float(d) : 0.0} - BOOL_CAST = Proc.new {|d| d ? (d == 'True' ? true : false) : false } + BOOL_CAST = Proc.new {|d| d ? (d.to_s.downcase == 'true' ? true : false) : false } DATE_CAST = Proc.new {|d| d ? Date.parse(d).strftime("%Y-%m-%d") : Date.today.strftime("%Y-%m-%d") } TIME_CAST = Proc.new {|d| d ? Time.parse(d).xmlschema : Time.now.xmlschema } INT_CAST = Proc.new {|d| d ? Integer(d.to_i) : 0 }