Skip to content

Add support for user public events. - #274

Merged
phadej merged 1 commit into
haskell-github:masterfrom
picnoir:get-user-events
May 10, 2017
Merged

phadej merged 1 commit into
haskell-github:masterfrom
picnoir:get-user-events

Conversation

@picnoir

@picnoir picnoir commented Apr 25, 2017

Copy link
Copy Markdown
Contributor

Implement improvement #273

This PR implements a get method as well as its associated tests for this endpoint: https://developer.github.com/v3/activity/events/#list-public-events-performed-by-a-user

Since the get repository events endpoint (https://developer.github.com/v3/activity/events/#list-repository-events) was quite similar and was missing integration tests, I took advantage of this PR to write some.

I tried to respect as much as I could your coding style regarding tests, hope I managed to do that right.

Please note that I am a beginner regarding haskell, do not hesitate to let me know if I can improve something. I will not be offended and glad to fix that!

Have a nice day!

@phadej phadej left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM, make travis green, and I'll merge this.

Comment thread spec/GitHub/EventsSpec.hs
where shouldSucceed f = withAuth $ \auth -> do
cs <- GitHub.executeRequest auth $ f
cs `shouldSatisfy` isRight
length (fromRightS cs) `shouldSatisfy` (> 1)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

use

import Prelude ()
import Prelude.Compat

to get correct (polymorphic) length.

Comment thread spec/GitHub/EventsSpec.hs
GitHub.repositoryEventsR "phadej" "github" 1
describe "userEventsR" $ do
it "returns non empty list of events" $ shouldSucceed $ GitHub.userEventsR "phadej" 1
where shouldSucceed f = withAuth $ \auth -> do

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Note to self: refactor this when merged (quicker to do myself, than try to explain what I want).

@picnoir

picnoir commented Apr 25, 2017

Copy link
Copy Markdown
Contributor Author

Thanks for the quick feedback.

Alright, I'm going to get that pass through travis.

I'll squash, force push and let you know when I'm done.

@picnoir

picnoir commented Apr 25, 2017 •

Copy link
Copy Markdown
Contributor Author

Alright, it should be ok now. I'll just let travis run.

I was watching travis's logs and noticed it lacks a github API key hence integration tests are skipped:

GitHub.Activity
watchersForR
works
# PENDING: no GITHUB_TOKEN
myStarredR
works
# PENDING: no GITHUB_TOKEN
GitHub.Commits
commitsFor
works
# PENDING: no GITHUB_TOKEN
limits the response
# PENDING: no GITHUB_TOKEN

I do not know if you are aware about that…

I ran these tests locally, they all pass using the lts-7 Haskell.

@phadej

phadej commented Apr 25, 2017

Copy link
Copy Markdown
Contributor

yeah, GITHUB_TOKEN is private and not set for non-member builds (otherwise you could expose them, by modifying .travis.yml); that's not an issue.

I'll look at this tomorrow

@picnoir

picnoir commented May 9, 2017 •

Copy link
Copy Markdown
Contributor Author

Hey @phadej, hope you are doing well. Friendly bump.

@phadej
phadej merged commit 62bf2b0 into haskell-github:master May 10, 2017
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