diff --git a/lib/restfulie/client/http/verb_request.rb b/lib/restfulie/client/http/verb_request.rb index c5ce2c54..c86cc34c 100644 --- a/lib/restfulie/client/http/verb_request.rb +++ b/lib/restfulie/client/http/verb_request.rb @@ -8,7 +8,7 @@ def initialize(requester) # * path: '/posts' # * headers: {'Accept' => '*/*', 'Content-Type' => 'application/atom+xml'} def get(params = {}) - request(:get, add_querystring(path, params), headers) + request(:get, add_query_string(path, params), headers) end # HEAD HTTP verb without {Error} @@ -53,7 +53,7 @@ def delete # * path: '/posts' # * headers: {'Accept' => '*/*', 'Content-Type' => 'application/atom+xml'} def get!(params = {}) - request!(:get, add_querystring(path, params), headers) + request!(:get, add_query_string(path, params), headers) end # HEAD HTTP verb {Error} @@ -96,7 +96,7 @@ def delete! protected - def add_querystring(path, params) + def add_query_string(path, params) params = params.map { |param, value| "#{param}=#{value}"}.join("&") params.blank? ? path : URI.escape("#{path}?#{params}") end diff --git a/tests/spec/requests/http/adapter_spec.rb b/tests/spec/requests/http/adapter_spec.rb index 8e36c85f..8c39cbd7 100644 --- a/tests/spec/requests/http/adapter_spec.rb +++ b/tests/spec/requests/http/adapter_spec.rb @@ -10,39 +10,39 @@ end it "should get and respond 200 code" do - @client.get("/test").should respond_with_status(200) + @client.at("/test").get.should respond_with_status(200) end it "should put and respond 200 code" do - @client.put("/test", "test").should respond_with_status(200) + @client.at("/test").put("test").should respond_with_status(200) end it "should delete and respond 200 code" do - @client.delete("/test").should respond_with_status(200) + @client.at("/test").delete.should respond_with_status(200) end it "should head and respond 200 code" do - @client.head("/test").should respond_with_status(200) + @client.at("/test").head.should respond_with_status(200) end it "should get! and respond 200 code" do - @client.get!("/test").should respond_with_status(200) + @client.at("/test").get!.should respond_with_status(200) end it "should post! and respond 201 code" do - @client.post!("/test", "test").should respond_with_status(201) + @client.at("/test", "test").post!.should respond_with_status(201) end it "should put! and respond 200 code" do - @client.put!("/test", "test").should respond_with_status(200) + @client.at("/test", "test").put!.should respond_with_status(200) end it "should delete! and respond 200 code" do - @client.delete!("/test").should respond_with_status(200) + @client.at("/test").delete!.should respond_with_status(200) end it "should head! and respond 200 code" do - @client.head!("/test").should respond_with_status(200) + @client.at("/test").head!.should respond_with_status(200) end end