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

Add Connect with Email Feature #188

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions lib/linked_in/api/update_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,27 @@ def send_message(subject, body, recipient_paths)
post(path, message.to_json, "Content-Type" => "application/json")
end

def invite_by_email(email)
require 'uri'
path = "/people/~/mailbox"
safe_email = URI.escape(email)
message = {
'subject' => "Join my network on LinkedIn",
'body' => "I'd like to add you to my professional network on LinkedIn.",
'recipients' => {
'values' => [{
'person' => { '_path' => "/people/email=#{safe_email}" }
}]
},
'item-content' => {
'invitation-request' => {
'connect-type' => 'friend'
}
}
}
post(path, message.to_json, "Content-Type" => "application/json")
end

def post_group_discussion(group_id, discussion)
path = "/groups/#{group_id}/posts"
post(path, discussion.to_json, "Content-Type" => "application/json")
Expand Down