Git Product home page Git Product logo

Comments (4)

andyjeffries avatar andyjeffries commented on August 15, 2024

Have you tried reversing your get lines in the proxy? From memory each get registers a handler and the proxying stops with the first match. So this may work better:

class ApiCoalitionProxy < ActiveRestClient::ProxyBase
  get "/coalitions/:id" do
    # ...
  end

  get "/coalitions" do
    # ...
  end
end

Let me know if that resolves it (and if so I'll make it clearer in the README).

Thanks for reporting the issue.

from active-rest-client.

jtmkrueger avatar jtmkrueger commented on August 15, 2024

Unfortunately, no luck. Here's what I tried:

class ApiCoalitionProxy < ActiveRestClient::ProxyBase
  get "/coalitions/:id" do
    response = passthrough
    translate(response) do |body|
      result = body['result']
      result
    end
  end

  get "/coalitions" do
    response = passthrough
    translate(response) do |body|
      result = body['result']
      result
    end
  end
end

class ApiCoalition < ActiveRestClient::Base
  proxy ApiCoalitionProxy
  base_url 'https://cleancities-stage.nrel.gov/api/v1/'

  get :all, '/coalitions'
  get :find, '/coalitions/:id'
end

from active-rest-client.

jtmkrueger avatar jtmkrueger commented on August 15, 2024

Well, it looks like this is my fault. It was caching in my development environment. Once I turned that off, things started looking right!

from active-rest-client.

andyjeffries avatar andyjeffries commented on August 15, 2024

LOL. No worries, glad you found the answer (I was wondering what on earth was going on and was going to build a test project to replicate it).

from active-rest-client.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.