Permalink
Browse files

found a much better place to uri encode to dry up the code

  • Loading branch information...
1 parent b5fb272 commit 76fd2fdf99bd9326faa700140d3714b5072dbc0a @rauhryan rauhryan committed May 5, 2012
Showing with 5 additions and 6 deletions.
  1. +1 −1 lib/ghee/resource_proxy.rb
  2. +3 −3 lib/ghee/state_methods.rb
  3. +0 −1 lib/ghee/uri_escape.rb
  4. +1 −1 lib/ghee/version.rb
@@ -23,7 +23,7 @@ class ResourceProxy
# path_prefix - String
#
def initialize(connection, path_prefix, params = {})
- @connection, @path_prefix, @params = connection, path_prefix, params
+ @connection, @path_prefix, @params = connection, URI.escape(path_prefix), params
end
# Method_missing takes any message passed
@@ -6,23 +6,23 @@ module CUD
# return json
#
def create(attributes)
- connection.post(URI.escape(path_prefix),attributes).body
+ connection.post(path_prefix,attributes).body
end
# Patchs
#
# return json
#
def patch(attributes)
- connection.patch(URI.escape(path_prefix), attributes).body
+ connection.patch(path_prefix, attributes).body
end
# Destroys
#
# return boolean
#
def destroy
- connection.delete(URI.escape(path_prefix)).status == 204
+ connection.delete(path_prefix).status == 204
end
end
View
@@ -2,7 +2,6 @@ class Ghee
module Middleware
class UriEscape < Faraday::Middleware
def call(env)
-
env[:url] = URI.parse(URI.escape(env[:url].to_s))
@app.call(env)
end
View
@@ -1,4 +1,4 @@
# encoding: UTF-8
class Ghee
- VERSION = "0.9.3"
+ VERSION = "0.9.4"
end

0 comments on commit 76fd2fd

Please sign in to comment.