flapjack / flapjack-diner

Consumer of the Flapjack API
http://flapjack.io/
MIT License
17 stars 10 forks source link

Flapjack::Diner.entities returns a hash rather than an array #19

Closed jswoods closed 10 years ago

jswoods commented 10 years ago

According to the docs, Flapjack::Diner.entities should return an array, but instead it returns a hash. So rather than Flapjack::Diner.entities.each I have to do Flapjack::Diner.entities['entities'].each.

Perhaps this is a bug with flapjack rather than flapjack-diner, but I'll just file it here and let you decide :)

ghost commented 10 years ago

Is this being used to access the 'api' gateway or the 'jsonapi' one? https://github.com/flpjck/flapjack/blob/master/lib/flapjack/gateways/api/entity_methods.rb#L136 looks to return an array to me, and I haven't yet started work on a parallel branch in flapjack-diner to support the JSONAPI work, which is all quite WIP at the moment.

Any discrepancies should be filed as bugs in this project, so you did the right thing there :smile:

jswoods commented 10 years ago

Ah, okay. This was hitting the jsonapi. I do think it's odd though that the api gateway returns an array but the jsonapi returns a hash, but sounds like that's not necessarily relevant here. Thanks!

ghost commented 10 years ago

We're planning to deprecate (and later remove) the API gateway once the JSONAPI gateway is complete, flapjack-diner is converted to use it, etc. JSONAPI has a consistent format for the object representations, while our work in the API gateway is a little inconsistent in that regard. The wrappings are actually the main difference, the actual object loading code won't need to change much.

I've raised https://github.com/flpjck/flapjack-diner/issues/20 to cover the necessary work.