Skip to content
Open
Changes from 6 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
20 changes: 20 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,26 @@ def send_message(subject, body, recipient_paths)
post(path, message.to_json, "Content-Type" => "application/json")
end

def connect_by_email(email)
Copy link
Owner

Choose a reason for hiding this comment

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

I think we should use the verb invite instead of connect since it's talked about in the api as invitations

path = "/people/~/mailbox"

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=#{email}" }
Copy link
Contributor

Choose a reason for hiding this comment

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

you should make sure to URI escape the 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