Skip to content
Browse files

Merge commit 'runpaint/master'

  • Loading branch information...
2 parents 3a2d979 + 141310d commit 5addb0bbca8b0af62c7c431c1a6eb3886e4fa832 @fcoury fcoury committed Apr 23, 2009
Showing with 6 additions and 4 deletions.
  1. +6 −4 lib/octopi.rb
View
10 lib/octopi.rb
@@ -77,12 +77,14 @@ def initialize(login = nil, token = nil, format = "yaml")
@login = login
@token = token
@read_only = false
+ self.class.default_params :login => login, :token => token
end
end
-
- %w[keys emails].each do |action|
+
+
+ {:keys => 'public_keys', :emails => 'emails'}.each_pair do |action, key|
define_method("#{action}") do
- get("/user/#{action}")
+ get("/user/#{action}")[key]
end
end
@@ -139,6 +141,7 @@ def submit(path, params = {}, format = "yaml", &block)
end
query = login ? { :login => login, :token => token } : {}
query.merge!(params)
+ resp = yield(path, query.merge(params), format)
if @trace_level
case @trace_level
@@ -151,7 +154,6 @@ def submit(path, params = {}, format = "yaml", &block)
end
end
- resp = yield(path, query, format)
raise APIError,
"GitHub returned status #{resp.code}" unless resp.code.to_i == 200
# FIXME: This fails for showing raw Git data because that call returns

0 comments on commit 5addb0b

Please sign in to comment.
Something went wrong with that request. Please try again.