Closed stanleyyuenyiu closed 3 years ago
Is it possible to use it over on a proxy api inside the grape?
for example:
Let say I have a API, it will call another 3rd party restful API, and I want to model the response with an custom entity, how should I do that
Say the 3rd part API will return { items: [ {id:111} ], page: 1, total:3 }
{ items: [ {id:111} ], page: 1, total:3 }
And the model looks like
class ItemListEntity < Grape::Entity present_collection true expose :items, using: ItemEntity expose :page, expose :total end class ItemEntity < Grape::Entity expose :id end
And i format it by
result = find_items_from_api present Hashie::Mash.new(result), with: ItemListEntity
But it doesn't work
please use ruby-grape for questions
Is it possible to use it over on a proxy api inside the grape?
for example:
Let say I have a API, it will call another 3rd party restful API, and I want to model the response with an custom entity, how should I do that
Say the 3rd part API will return
{ items: [ {id:111} ], page: 1, total:3 }
And the model looks like
And i format it by
But it doesn't work