2011-05-05 54 views

回答

1

看起來像你不能,但。自述:

TODO

更改爲JSON API

更新和正確的測試套件

變化法拉第認證

通過實施消息的API

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"}) 
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"])

+0

看起來這是爲了對前面的ans做出評論WER。不要發表評論作爲答案。 – Korem 2014-06-25 16:36:00

+0

這不提供問題的答案。要批評或要求作者澄清,在他們的帖子下留下評論 - 你總是可以評論你自己的帖子,一旦你有足夠的[聲譽](http://stackoverflow.com/help/whats-reputation),你會能夠[評論任何帖子](http://stackoverflow.com/help/privileges/comment)。 – 2014-06-25 18:09:07

+0

@EricBrown我已經發布了答案邀請人民的ID有沒有這樣的答案,當我谷歌,所以我發佈這種答案的一種建議。 – joshuawatson 2014-06-26 08:47:40

相關問題