dmacvicar / ruby-sfcc

ruby bindings for sblim client
MIT License
6 stars 6 forks source link

Provide a way to pass type information along with value to methods #8

Closed miminar closed 12 years ago

miminar commented 12 years ago

Made CIMData a ruby object to allow passing values along with types to client methods.

Use case:

Some C sfcb provider is accepting a UInt8 value as method parameter. Originally passing some integer to a method as parameter would turn in into CIMCData d = { .type = CIMC_sint64, .value.sint64 = val }; But providers are often coded in the way, that they check for exact type of input parameter and fail in case they not match. So with this modification one can write:

client.invoke_method(object_path, "some_method_name",
    { "Param1" => Sfcc::Cim::Data.new("UInt8", 10) }, out)
kkaempf commented 12 years ago

Please provide test cases for the features you added

miminar commented 12 years ago

I hope that every feature I added is tested in test/test_sfcc_cim_data.rb. Unfortunatelly I left some specific settings to my setup in test/helper.rb, I will fix it and hopefully find a way to make it more general. I will also make some example(s). I'll get to the fixing/example and comments making by the end of the week.

Thank you for your feedback, I'll try to comply to any demands you have.

kkaempf commented 12 years ago

Take the comments as an open discussion to improve the code, not as demands. Your ideas are as good/bad as mine :-)

miminar commented 12 years ago

I value your opinions high, because you both are certainly more skilled ruby extension writers, then I am. :-) ruby-sfcc is actually my first touch with ruby extensions and almost with ruby itself.