Comments (4)
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.
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.
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.
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)
- Clean-up superclass-overridable password handling
- Feature Request: `in_parallel` takes 0 arguments and defaults to base url
- Unable to access site without SSL cert HOT 4
- Multiple clients for same API HOT 8
- Check out the Flexirest fork HOT 2
- In a controller, update_attributes is not supported HOT 1
- typo in validation block example? HOT 1
- Issue with automatic DateTime parse Base.initialize HOT 3
- Update ReadMe to reflect that only PUT and POST sign requests HOT 5
- Cannot use HTTP PATCH requests HOT 3
- Datetime Regex breaks for Australian Postcodes HOT 5
- ruby 1.8.7 broken HOT 2
- PLEASE CAN YOU DEPRECATE THIS GEM! HOT 2
- cannot achieve get request HOT 4
- certificate verify failed error HOT 2
- Feature request: auto escape :id
- Feature request: auto escape :id or allow overriding the value of :id easily HOT 5
- Multiple clients for different APIs HOT 1
- ProxyBase translate does not understand XML HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from active-rest-client.