nicklandgrebe / active-resource.js

ActiveResource.js - API resource relational mapping in JavaScript
https://active-resource.js.org
MIT License
133 stars 20 forks source link

Expect response format like rails/activeresource #65

Open PedroAugustoRamalhoDuarte opened 2 years ago

PedroAugustoRamalhoDuarte commented 2 years ago

Hello thanks for this great lib.

Is there a easy way to fetch record like we do in https://github.com/rails/activeresource? Like this:

# Expects a response of
#
# [
#   {"id":1,"first":"Tyler","last":"Durden"},
#   {"id":2,"first":"Tony","last":"Stark",}
# ]
#
# for GET http://api.people.com:3000/people.json
#
people = Person.all
people.first  # => <Person::xxx 'first' => 'Tyler' ...>
people.last  # => <Person::xxx 'first' => 'Tony' ...>