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

Monkey patch Octokit::Client to access Checks API #61

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

ashmaroli
Copy link
Member

Continuation of comments in #60

With this we temporarily enhance Octokit::Client to send requests to a couple of endpoints in
the Checks API.

Initial implementation

(Along similar lines as existing methods included within Octokit::Client)

  • The methods expect to receive the repository name in the name_with_owner pattern as the first parameter instead of a URL.
  • The last parameter is a Hash (technically a Sawyer::Resource instance) instead of a JSON payload currently sent.

/cc @mattr-

Copy link
Member

@mattr- mattr- left a comment

Choose a reason for hiding this comment

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

Looks good with a couple of minor nits.

I'd like to see the file renamed to octokit_checks_api_patch.rb so it's more obvious from the filename what it is.

# https://developer.github.com/v3/checks/runs/#create-a-check-run
# -----------------------------------------------------------------------------------
def create_check_run(repo, options)
post "#{Repository.path repo}/check-runs", options.merge(PREVIEW_HEADER)
Copy link
Member

Choose a reason for hiding this comment

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

parenthesis please inside the interpolation

# https://developer.github.com/v3/checks/runs/#update-a-check-run
# -----------------------------------------------------------------------------------
def update_check_run(repo, id, options)
patch "#{Repository.path repo}/check-runs/#{id}", options.merge(PREVIEW_HEADER)
Copy link
Member

Choose a reason for hiding this comment

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

parenthesis please inside the interpolation

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