2011-05-05 50 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

相关问题