Per the documentation for the operation.example_body method:
This looks at the parts defined for the SOAP body and returns a Hash that follows the structure
expected by Savon (needs to be formalized) to call the operation. Keys are matching parameter-/
element-names and values indicate the simple types. Currently this Hash contains both required
and optional elements without a good way to indicate what's required and what's not. If you can
think of a nice way to accomplish this, please let me know.
I like the idea of returning a clean hash for this, without meta-keys like attributes! to define additional information.
What I'd like to see as a solution for this would be something like subclassing the Hash class as, for example, HashWithSavonData, which could include the required_parameters? and optional_parameters? methods, for usage as below.
> body = operation.example_body
=> {
updateStatus: {
accountID: 'string',
accountStatus: 'string'
}
openCase: {
accountID: 'string',
subject: 'string',
message: 'string'
}
}
> body[:openCase].required_parameters?
=> [:accountID, :message]
> body[:openCase].optional_parameters?
=> [:subject]