mwunsch / weary

A framework and DSL for building RESTful web service clients
MIT License
480 stars 23 forks source link

Resource nested hash support #42

Closed artempartos closed 10 years ago

artempartos commented 10 years ago

I use Weary for my client. In some my API i use ransack and often i have a nested hash in params. For example i have rest people index api, where three hash keys.

get :people, "/api/people.json" do |resource|
      resource.optional :q, :per_page, :page
end

Here page and per_page integer option, and q - ransack search nested hash. for example q[description_cont] or q[year_eq]. But with Weary::Resource i have error (test illustrate it)

 TypeError:
       Can't convert Hash into String.

It's famous addresable issue https://github.com/sporkmonger/addressable/issues/36 which fixed in addresable 2.2.7 and broken in addresable 2.3. I decide fix this bug here, because addresable maintainer doss't want do it (https://github.com/sporkmonger/addressable/pull/84) and minor version of Weary is higher than 2.2.