-
Notifications
You must be signed in to change notification settings - Fork 63
Replace graph #53
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
Replace graph #53
Conversation
|
Nice 👍 I just took a quick look and haven't done a deep dive, but one thing sticks out: do we even need |
4d3c1dc to
b7d31e9
Compare
|
Ya, you're right. HTTPoison is pulling it in anyway. |
README.md
Outdated
| We encourage contribution from anyone! If you've got an improvement to the documentation or feature you've implemented, please open a [pull request](https://github.com/mweibel/facebook.ex/pulls). | ||
| This project uses [credo](https://github.com/rrrene/credo) for code analysis. Running `mix credo` will give you a nice output which will tell you if any of the changes you've made aren't consistent with the rest of our codebase. | ||
|
|
||
| The Facebook Graph API is fairly large and as such we're not using every facet of it, so if you're not seeing an edge that is handled, please report an [issue](https://github.com/mweibel/facebook.ex/issues). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
report an issue or open a PR to add it?
| See [API Documentation for facebook.ex](http://hexdocs.pm/facebook/). | ||
| ## Contributing | ||
| We encourage contribution from anyone! If you've got an improvement to the documentation or feature you've implemented, please open a [pull request](https://github.com/mweibel/facebook.ex/pulls). | ||
| This project uses [credo](https://github.com/rrrene/credo) for code analysis. Running `mix credo` will give you a nice output which will tell you if any of the changes you've made aren't consistent with the rest of our codebase. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great!
|
Just had a brief look but so far this looks amazing! Thanks for that! |
|
|
||
| alias Facebook.Config | ||
|
|
||
| def process_url(url), do: Config.graph_url <> url |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a pattern matching idea for how to combine this with the GraphVideoApi module, I just need a sec to test it. Essentially I think we can pattern match off a binary passed in
| ] | ||
| end | ||
|
|
||
| defp request do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so much cleaner than what I had 👍
| end, | ||
| body: fn(_) -> Facebook.GraphMock.me(:success) end | ||
| ] do | ||
| with_mock :hackney, GraphMock.mock_options( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:hackney mock is probably not needed anymore, or is it?
|
Went a bit more through it and that all seems ok. A bit confused about the hackney mocks there. Is it because HTTPoison uses hackney internally? |
| end, | ||
| body: fn(_) -> Facebook.GraphMock.me(:success) end | ||
| ] do | ||
| with_mock :hackney, GraphMock.mock_options( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If someone wouldn't mind enlightening me, I actually don't understand how this still works. From my undertanding with_mock takes a module, and then mocks out the methods on that module via the given list. How does with_mock :hackney, still work here?
|
Oops, looks I forgot to submit my review last night 🤷♀️ |
|
Exactly! HTTPoison is just a wrapper for hackney (just as Now, we could be explicit and go the route of mocking the HTTPoison method functions, but I sorta like the consistency as is. Since it does seem to raise some Thanks for the feedback @paulruescher & @mweibel -- I think this is good to go. @mweibel I'd be happy to help out with version publishing! |
|
Awesome, I def agree with keeping it for now. I know we talked mocking briefly before, but I've been using this as a guide recently for structuring 3rd party API calls of my own http://blog.plataformatec.com.br/2015/10/mocks-and-explicit-contracts/ Seems to work quite well. Definitely future consideration tho 👍 Awesome work 🎉 |
|
I read that same blog post as I was working on this 😄 |
|
Thanks! |
The main change here is
Facebook.Graphis replaced withFacebook.GraphAPI&Facebook.GraphVideoAPI, the HTTP response formatting functions were moved into a separate module,ResponseFormatter. One thing to consider is combining and moving the http request + formatter calls into the existingFacebook.Graph, but I do like having the HTTP library exposed in the main library opposed to in another wrapper as we get a bit more flexibility in configuring requests without having to modify a wrapper module.I ended up updating a bit of documentation as well since I was basically touching every function as I was doing this. Added some
@typedocsand provided a few links here and there. Also added a blurb about contributing to the README.When we bump to v2.11 of the graph API we may be able to ditch the additional wrapper around the video api as I believe it's all now under the single
graph_url. Things still seemed to work as they are on v2.11 when I tested, though.Last thing, looks like #48 is stagnant, so, if there's no feedback that results in major changes to this PR, I'll start looking into implementing the
chatendpoints on top of this. Regardless, appreciate any feedback guys!