Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

support query params on api requests

  • Loading branch information...
commit 17b0a41b675ec3b57b03f0b3c8515d7820b6262d 1 parent 84a49ab
@atmos atmos authored
Showing with 12 additions and 5 deletions.
  1. +11 −4 lib/warden-github/user.rb
  2. +1 −1  lib/warden-github/version.rb
View
15 lib/warden-github/user.rb
@@ -64,14 +64,18 @@ def team_member?(team_id)
# Send a V3 API GET request to path and parse the response body
#
# path - the path on api.github.com to hit
+ # params - extra params for calling the api
#
# Returns a parsed JSON response
#
# Examples
# github_request("/user")
# # => { 'login' => 'atmos', ... }
- def github_request(path)
- Yajl.load(github_raw_request(path))
+ #
+ # github_request("/user/repos", {:page => 2})
+ # # => [ { 'name' => 'gollum' ... } ]
+ def github_request(path, params = {})
+ Yajl.load(github_raw_request(path, params))
end
# Send a V3 API GET request to path
@@ -83,8 +87,11 @@ def github_request(path)
# Examples
# github_raw_request("/user")
# # => RestClient::Response
- def github_raw_request(path)
- RestClient.get("#{github_api_uri}/#{path}", :params => { :access_token => token }, :accept => :json)
+ #
+ # github_raw_request("/user/repos", {:page => 3})
+ # # => RestClient::Response
+ def github_raw_request(path, params = {})
+ RestClient.get("#{github_api_uri}/#{path}", :params => params.merge({ :access_token => token }), :accept => :json)
end
private
View
2  lib/warden-github/version.rb
@@ -1,5 +1,5 @@
module Warden
module Github
- VERSION = "0.5.0"
+ VERSION = "0.5.1"
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.