-1

So I am using rest-client gem and am able to get a response from my API request and the response is as follows:

{"Invoice"=>[{"ReqKey"=>"9", "RequestID"=>"9B06C27E61BE4B8DB6B9", "SyncGuid"=>"D98013521663AE4E8251A327B0032A2C"}, {"ReqKey"=>"12", "RequestID"=>"E34FAB7ED5D74D30A61E", "SyncGuid"=>"9A01B67D186C0E4ABF787002624A97C5"}]}

As you can see it is returning an array[2] of Invoice. My question is how do I determine the array size that is returned?

If it helps I am able to pull out values with the following but really need to how big the array is.

resp = $RESPONSE['Invoice'][0]
value = resp.fetch("ReqKey")

returns correct value 9

Another question: what format is this response?

orde
  • 5,233
  • 6
  • 31
  • 33
Ken
  • 1
  • 1

1 Answers1

0

I guess I answered my own question. Randomly tried

resp2 = $RESPONSE['Invoices']['Invoice'].size

and it worked.

Would still like to know what format this technically is.

Simple Lime
  • 10,790
  • 2
  • 17
  • 32
Ken
  • 1
  • 1