Forum: Ruby on Rails How to use nested arrays in ActionWebService?

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Manuel H. (Guest)
on 2006-01-31 19:16
(Received via mailing list)
Hi list.

I am writing a data structure definition for my web service API that
has - besides others - a nested array of integers: I want to have an
array that contains arrays which themselves contain two integer values.

An example for this is:

   [ [1, 2], [2, 400] ]

These values represent a distribution and in this exapmmle this means
that the event "hit 1 time" occured two times and "hit 2 times"
occured 400 times.

When I try to implement this the following way I get an error ("nil
where it was not expected, maybe you wanted an array instead"):

class ProductStatistics < ActionWebService::Struct
   member :name, :string

   member :hit_distribution, [[:int]]

When I changed this to a flat integer array, it worked:

class ProductStatistics < ActionWebService::Struct
   member :name, :string

   member :hit_distribution, [:int]

Now, my question: Is it possible to specify that I want nested arrays
of integers in my web service API and if yes: how?


Manuel H.
This topic is locked and can not be replied to.