Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API endopoints paths must not depend on ActiveSupport pluralization as it breaks with other languages #262

Open
vizcay opened this issue May 1, 2019 · 0 comments
Projects

Comments

@vizcay
Copy link

vizcay commented May 1, 2019

I've added ruby-trello on a Rails v4.2 project (had used it without problems in others projects without rails).

To my surprise when I started trying to query anything 404 errors began:

pry(main)> Trello::Organization.find('xxx')
E, [2019-05-01T13:01:11.722604 #74796] ERROR -- : [404 GET https://api.trello.com/1/organizationes/xxx]: Cannot GET /1/organizationes/sistemasvizcay?key=xxx&token=xxx
Trello::Error: Cannot GET /1/organizationes/xxx?key=xxx&token=xxx
from /Users/pablo/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0/gems/ruby-trello-2.1.0/lib/trello/client.rb:99:in `invoke_verb'

What quickly got my attention was Cannot GET /1/**organizationes**/. Clearly something was odd and after digging at the code I've found this:

    def find(path, id, params = {})
      response = get("/#{path.to_s.pluralize}/#{id}", params)
      trello_class = class_from_path(path)
      trello_class.parse response do |data|
        data.client = self
      end
    end

Clearly the path is being pluralized via ActiveSupport.. but, what If my Rails project has spanish language inflections as is the case? This is brittle and a bad idea as it only works with the english inflections rules. Worst, It looks I cannot configure it some other way than monkey patching.

Any chance this will be fixed?

@vizcay vizcay changed the title API endopoints path must not depend on ActiveSupport pluralization as it breaks with other languages API endopoints paths must not depend on ActiveSupport pluralization as it breaks with other languages May 1, 2019
@hoppergee hoppergee added this to Anything in Backlog Mar 10, 2020
@hoppergee hoppergee moved this from Draft to Enhancement in Backlog Mar 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Backlog
  
Enhancement
Development

No branches or pull requests

2 participants