Skip to content

Commit

Permalink
Add Octokit::Client::Apps#find_user_installations method
Browse files Browse the repository at this point in the history
  • Loading branch information
greysteil committed May 30, 2017
1 parent c3aa3e0 commit 5aed8a4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
12 changes: 12 additions & 0 deletions lib/octokit/client/apps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,18 @@ def find_integration_installations(options = {})
find_app_installations(options)
end

# Find all installations that are accessible to the authenticated user
#
# @param options [Hash] An customizable set of options
#
# @see https://developer.github.com/v3/apps/#list-installations-for-user
#
# @return [Array<Sawyer::Resource>] A list of installations
def find_user_installations(options = {})
opts = ensure_api_media_type(:integrations, options)
paginate "/user/installations", opts
end

# Get a single installation
#
# @param id [Integer] Installation id
Expand Down
10 changes: 9 additions & 1 deletion spec/octokit/client/apps_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,20 @@

describe ".find_app_installations", :vcr do
it "returns installations for an app" do
installations = @jwt_client.find_integration_installations
installations = @jwt_client.find_app_installations
expect(installations).to be_kind_of Array
assert_requested :get, github_url("/app/installations")
end
end # .find_app_installations

describe ".find_user_installations", :vcr do
it "returns installations for a user" do
installations = @client.find_user_installations
expect(installations).to be_kind_of Array
assert_requested :get, github_url("/user/installations")
end
end # .find_user_installations

context "with app installation", :vcr do
let(:installation) { test_github_integration_installation }

Expand Down

0 comments on commit 5aed8a4

Please sign in to comment.