victor-am / rails-ranger

🤠 An opinionated AJAX client for Ruby on Rails APIs
https://victor-am.github.io/rails-ranger/
MIT License
32 stars 5 forks source link

Interchangeable API adapters #18

Open victor-am opened 6 years ago

victor-am commented 6 years ago

Allow a set of official adapters (like ActiveModelSerializer's JSON API, Attributes, etc) and the possibility of passing a custom adapter to the Rails Ranger client.

I thought something like that:

import RailsRanger from 'rails-ranger'

//
// Official adapter
//
const api = new RailsRanger({
  adapter: 'officialAdapterName'
})

//
// Custom adapter
//
const myAdapter = {
  // Some object describing the adapter
}

const api = new RailsRanger({
  adapter: myAdapter
})

But as always I'm open to suggestions 😄