Skip to content

Commit 1bbda30

Browse files
committed
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
1 parent a49a6e9 commit 1bbda30

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/qbxml/types.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
module Qbxml::Types
22

3-
XML_DIRECTIVES = {
3+
XML_DIRECTIVES = {
44
:qb => [:qbxml, { version: '7.0' }],
55
:qbpos => [:qbposxml, { version: '3.0' }]
66
}.freeze
77

88
FLOAT_CAST = Proc.new {|d| d ? Float(d) : 0.0}
9-
BOOL_CAST = Proc.new {|d| d ? (d == 'True' ? true : false) : false }
9+
BOOL_CAST = Proc.new {|d| d ? (d.to_s.downcase == 'true' ? true : false) : false }
1010
DATE_CAST = Proc.new {|d| d ? Date.parse(d).strftime("%Y-%m-%d") : Date.today.strftime("%Y-%m-%d") }
1111
TIME_CAST = Proc.new {|d| d ? Time.parse(d).xmlschema : Time.now.xmlschema }
1212
INT_CAST = Proc.new {|d| d ? Integer(d.to_i) : 0 }

0 commit comments

Comments
 (0)