Skip to content
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