Skip to content
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

Generate hooks client #1161

Merged
merged 9 commits into from
Nov 18, 2019
Merged

Generate hooks client #1161

merged 9 commits into from
Nov 18, 2019

Conversation

indigok
Copy link

@indigok indigok commented Oct 31, 2019

Part of #1157. Continues to generalize the openapi_client_generator and generates the hooks.rb client.

There are breaking changes as a few of the method definitions have changed, however the underlying api calls appeared to have changed and the old methods don't completely work. This does removes support for service hooks (which aren't supported in general anymore) and parse_payload which is a helper function. Also, remove_hook is now delete_hook and test_hook is test_push_hook as these more closely resemble the API.

This also retroactively affects the previous generated clients as we changed list calls to paginate.

TODOs:

  • add a check that the required key of the config parameter, url, is present
  • clean up testing for hooks_spec and openapi_client_generator_spec

Copy link
Member

@tarebyte tarebyte left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🍰 just a few questions.

# @return [Boolean] True if hook removed, false otherwise.
# @param repo [Integer, String, Repository, Hash] A GitHub repository
# @param hook_id [Integer] The ID of the hook
# @return <Boolean> True on success, false otherwise
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like this should be

Suggested change
# @return <Boolean> True on success, false otherwise
# @return [Boolean] True on success, false otherwise

context "with repository" do
before(:each) do
@repo = @client.create_repository("an-repo")
@repo = @client.create_repository("a-repo")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we maybe want to use the already created repo?

end

describe ".create_hook", :vcr do
it "creates a hook" do
assert_requested :post, github_url("/repos/#{@repo.full_name}/hooks")
end
it "returns with no config url passed" do
expect { @client.create_hook(@repo.full_name)}.to raise_error Octokit::MissingKey
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heather Harvey added 2 commits November 18, 2019 11:35
@indigok indigok merged commit 71fa11c into master Nov 18, 2019
@indigok indigok deleted the generate-hooks-client branch November 18, 2019 19:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants