Skip to content

Instantly share code, notes, and snippets.

@richmolj
Created July 17, 2017 21:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save richmolj/65783267aab0c7e6ea92f714f2245c91 to your computer and use it in GitHub Desktop.
Save richmolj/65783267aab0c7e6ea92f714f2245c91 to your computer and use it in GitHub Desktop.

This is just pseudo-code to give you a general idea:

# client code
class MyClient
  def get(params)
    RestClient.get '/some/api', params
  end
end
# resource code
allow_filter :name do |scope, val|
  scope.merge!(name: val)
end

def resolve(scope)
  MyClient.new.get(scope)
end
# controller code
# our "scope" is just a hash this time
render_jsonapi({})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment