linkedin
linkedin copied to clipboard
Update LinkedIn::Api::ShareAndSocialStream#add_share for Api v2
- The path changed to /v2/ugcPosts
- More attributes are required in the payload
Along with sending over the comment, you must send the user's "urn"
Example (updated):
client = LinkedIn::Client.new
client.authorize_from_access(token)
client.v2_add_share(urn, { comment: 'hi' })
https://docs.microsoft.com/en-us/linkedin/consumer/integrations/self-serve/share-on-linkedin?context=linkedin/consumer/context
@dsandstrom if you want to write a test for this I can review this and merge it and also cut a new gem.
Thanks!
Well the problem is this change breaks all other endpoints as they have not been updated for LinkedIn's API v2. I just wanted to show other people what I got working.
We could do something like Linkedin::V2.add_share too. That way it wouldn't break for others
Not sure how you want to keep v2 methods separate, but this allows v1 endpoints to still work. You said to do "something like Linkedin::V2.add_share", but that doesn't really make sense since we run
the methods on the LinkedIn::Client
. A possibility is to add a LinkedIn::V2::Client
, then include the v2 methods into that class.
nice work! I just put a few comments, mostly nitpicks and question type things.
I'm wondering if we should do something besides the prefixing of the methods for v2_* requests.
I think it's ok, it just feels a bit weird is all since v1 is mostly deprecated at this point.
Prefixing with v2 was just temporary. A V2 module needs to be set up. See https://github.com/hexgnu/linkedin/pull/274#issuecomment-472236744
Yea Linkedin::V2::Client makes sense. if you want to do that.
@hexgnu @dsandstrom Just a heads up I added the email endpoint in a fork and opened a PR on @dsandstrom fork. https://github.com/dsandstrom/linkedin/pull/1. My company needs it for our auth flow.
@hexgnu @dsandstrom I ended up adding a little more to my pr it now includes the additions:
- Default fields to the
/me
endpoint, which are now required by LinkedIn - Support for the v2 email address endpoint
- Parsing of the raw JSON responses from me and email endpoints
- Specs covering what was added above
https://github.com/dsandstrom/linkedin/pull/1
Meant to say this the first time, but I did not address any of the outstanding pr comments.
If you all want to combine forces feel free to do so :) will gladly review and merge in.
@dsandstrom @addbrick - great work! Thank you for doing this! If you all can get this in I can't wait to use it :)
Again happy to help merge this stuff in I just don't work with the linkedin API anymore so I'd be flying blind here :smile:.