我可以使用linkedin gem通过电子邮件发送邀请吗?
答案 0 :(得分:1)
看起来你还不能。从自述文件:
TODO
更改为json api
更新并更正测试套件
更改为法拉第进行身份验证
实施消息传递API
答案 1 :(得分:1)
配置/初始化/ linkedin.rb
LinkedIn::Client.class_eval do
def send_invitation(options)
path = "/people/~/mailbox"
message = {
"recipients" => {
"values" => [
{
"person" => {
"_path" => "/people/email=#{options[:email]}",
"first-name" => options[:first_name],
"last-name" => options[:last_name]
}
}]
},
"subject" => "Invitation to connect.",
"body" => options[:body],
"item-content" => {
"invitation-request" => {
"connect-type" => "friend"
}
}
}
post(path, message.to_json, "Content-Type" => "application/json")
end
end
像任何其他宝石方法一样使用
client.send_invitation({:email=>"email", :first_name=>"first name", :last_name=>"last name", :body=>"body"})
答案 2 :(得分:1)
LinkedIn::Client.class_eval do
def send_invitation(options)
path = "/people/~/mailbox"
message = {
"recipients" => {
"values" => [
{
"person" => {
"_path" => "/people/#{options[:id]}",
"first-name" => options[:first_name],
"last-name" => options[:last_name]
}
}]
},
"subject" => "Invitation to connect.",
"body" => options[:body],
"item-content" => {
"invitation-request" => {
"connect-type" => "friend",
"authorization" => {:"name" => 'NAME_SEARCH',:"value" => 'Mjwh'}
}
}
}
post(path, MultiJson.dump(message), "Content-Type" => "application/json")
end
end
邀请相关人员添加"authorization" => {:"name" => 'NAME_SEARCH',:"value" => 'Mjwh'}
来自搜索的人
client.search(:fields => [{ :people => %w(id first-name last-name api-standard-profile-request)}],:'first-name' => params["first_name"])