New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gh app #723
Merged
gh app #723
Changes from 22 commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
f4c1e26
add gh repo attributes
f064d01
change column to migrated_to_com
594c10d
update repo flag
11f6fc9
update names
4374ff4
revert to active_on_org
436d276
add github_installation_id to owner
84822b9
comment out breaking test
6eca455
use different migrations branch
60f5a10
Merge branch 'cd-gh-app' of github.com:travis-ci/travis-api into cd-g…
b112d8c
try pg 9.6
a7ce6a4
Merge branch 'master' into cd-gh-app
carlad ae9b303
remove unnecessary test
a2c7e79
update to installations
24b3433
use correct migrations branch
37be6f3
add test for github_installation_id
754282f
add renderer
161b8ec
update specs for github_installation_id
c14a023
add owner/github_installation_id endpoint
6995096
add check for type
a4414f3
change to github_id
231f59c
remove github_installation_id attribute on owner
8193673
add installation service end endpoint
a225d3f
remove redundant attributes on user and org
3aeac04
add access control, update param, add renderer expansion check
346a28d
update to :owner, add and update spec
505f403
revert to managed_by_installation
1316eae
add installation to repo renderer
820acb1
add association to user and org
606c0f5
allow overriding the travis-migrations branch being used with an envi…
rkh 2ebcde1
minor clean-ups
rkh 4398b3c
v3: allow filtering repositoires by managed_by_installation
rkh 321d73d
set travis migrations branch for ci
rkh 5e97ac1
Owner#installation: has_one is not wokring properly
rkh 9a62dcc
remove comments, update description
e3eefce
Merge branch 'master' into cd-gh-app
carlad 572e712
Merge branch 'master' into cd-gh-app
rkh 8437e07
Revert "set travis migrations branch for ci"
rkh File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,7 @@ env: | |
cache: bundler | ||
|
||
addons: | ||
postgresql: 9.3 | ||
postgresql: 9.6 | ||
|
||
services: | ||
- redis-server | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
module Travis::API::V3 | ||
class Models::Installation < Model | ||
belongs_to :owner, polymorphic: true | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
module Travis::API::V3 | ||
class Queries::Installation < Query | ||
params :id | ||
This comment was marked as spam.
Sorry, something went wrong. |
||
|
||
def find | ||
return Models::Installation.where(github_id: id) if id | ||
This comment was marked as spam.
Sorry, something went wrong. |
||
raise WrongParams, 'missing github_id'.freeze | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module Travis::API::V3 | ||
class Renderer::Installation < ModelRenderer | ||
representation(:minimal, :id, :github_id) | ||
representation(:standard, *representations[:minimal], :owner_type, :owner_id) | ||
This comment was marked as spam.
Sorry, something went wrong. |
||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module Travis::API::V3 | ||
class Services::Installation::Find < Service | ||
def run! | ||
result find | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
describe Travis::API::V3::Services::Installation::Find, set_app: true do | ||
let(:user) { Travis::API::V3::Models::User.find_by_login('svenfuchs') } | ||
let(:installation) { Travis::API::V3::Models::Installation.create(owner_type: 'User', owner_id: user.id, github_id: 789)} | ||
|
||
let(:token) { Travis::Api::App::AccessToken.create(user: user, app_id: 1) } | ||
let(:headers) {{ 'HTTP_AUTHORIZATION' => "token #{token}" }} | ||
|
||
before { user.save! } | ||
before { installation.save! } | ||
|
||
describe "authenticated as user with access" do | ||
before { get("/v3/installation/#{installation.github_id}", {}, headers) } | ||
example { expect(last_response).to be_ok } | ||
example { expect(JSON.load(body)).to be == { | ||
"@type" => "installation", | ||
"@href" => "/v3/installation/#{installation.github_id}", | ||
"@representation" => "standard", | ||
"@permissions" => {"read"=>true, "sync"=>true}, | ||
"id" => installation.id, | ||
"github_id" => installation.github_id, | ||
"owner_type" => installation.owner_type, | ||
"owner_id" => installation.owner_id | ||
}} | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This comment was marked as spam.
Sorry, something went wrong.