Skip to content

Commit

Permalink
ah, _method is a reserved keyword in ruby.
Browse files Browse the repository at this point in the history
  • Loading branch information
clayallsopp committed Feb 26, 2012
1 parent 9bc60b3 commit 9954362
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions gumroad.rb
Expand Up @@ -33,15 +33,15 @@ def uri(route)
URI.parse(self.url(route))
end

# method is string
def authed_request(uri, method, params = {})
klass = method.capitalize
# _method is string
def authed_request(uri, _method, params = {})
klass = _method.capitalize

http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::const_get(klass).new(uri.request_uri)
request.set_form_data(params) if method != "get"
request.set_form_data(params) if _method != "get"
if @token and @password
request.basic_auth(@token, @password)
end
Expand All @@ -59,10 +59,10 @@ def authed_request(uri, method, params = {})

# Client handles functions of the form
# Client.[method](resource, params = {})
def method_missing(method, *args, &block)
if [:post, :delete, :put].member? method
return authed_request(self.uri(args[0]), method.to_s, args[1]) if args.length == 2
return authed_request(self.uri(args[0]), method.to_s, {}) if args.length == 1
def method_missing(_method, *args, &block)
if [:post, :delete, :put].member? _method
return authed_request(self.uri(args[0]), _method.to_s, args[1]) if args.length == 2
return authed_request(self.uri(args[0]), _method.to_s, {}) if args.length == 1
else
super
end
Expand Down

0 comments on commit 9954362

Please sign in to comment.