Skip to content

Commit 99ff196

Browse files
authored
Enable serialization of nil values in structures sent to the API (#117)
Nil values can be sent to the API as shown in https://softlayer.github.io/python/order_quote/. Without this change, if we tried to do the same thing in softlayer- ruby, the xmlrpc library returns an error as it is not configured to serialize nil values.
1 parent bcf8d1c commit 99ff196

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

lib/softlayer/Service.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@ def with_warnings(flag)
1414
$VERBOSE = old_verbose
1515
end
1616

17-
# enable parsing of "nil" values in structures returned from the API
1817
with_warnings(nil) {
18+
# enable parsing of "nil" values in structures returned from the API
1919
XMLRPC::Config.const_set('ENABLE_NIL_PARSER', true)
20+
# enable serialization of "nil" values in structures sent to the API
21+
XMLRPC::Config.const_set('ENABLE_NIL_CREATE', true)
2022
}
2123

2224
# The XML-RPC spec calls for the "faultCode" in faults to be an integer

0 commit comments

Comments
 (0)