Post 如何从rails应用程序发布linkedin?

Post 如何从rails应用程序发布linkedin?,post,gem,ruby-on-rails-3.2,linkedin,Post,Gem,Ruby On Rails 3.2,Linkedin,是否可以通过RubyonRails应用程序发布linkedin。如果是这样,请指导我如何去做 我在谷歌上搜索了很多,但没有找到任何有效的正确解决方案 我的代码如下 对于控制器 require 'rubygems' require 'linkedin' class AuthController < ApplicationController def index LinkedIn.configure do |config| config.token = "somekey" conf

是否可以通过RubyonRails应用程序发布linkedin。如果是这样,请指导我如何去做

我在谷歌上搜索了很多,但没有找到任何有效的正确解决方案

我的代码如下

对于控制器

require 'rubygems'
require 'linkedin'
class AuthController < ApplicationController

def index
 LinkedIn.configure do |config|
  config.token = "somekey"
  config.secret = "somesecret"
end

LINKEDIN_CONFIGURATION = { :site => 'https://api.linkedin.com',
                    :authorize_path => '/uas/oauth/authenticate',
                    :request_token_path =>'/uas/oauth/requestToken?scope=r_basicprofile+r_emailaddress+r_network+r_contactinfo',
                    :access_token_path => '/uas/oauth/accessToken' }
client = LinkedIn::Client.new("some_key", "some_secret",  LINKEDIN_CONFIGURATION )
request_token = client.request_token(:oauth_callback => 
                              "http://#{request.host_with_port}/auth/callback")
session[:rtoken] = request_token.token # request token
session[:rsecret] = request_token.secret # request secret
redirect_to client.request_token.authorize_url
end

def create
   @user = User.find_or_create_from_auth_hash(auth_hash)
   self.current_user = @user
   redirect_to '/'
end

 protected
  def auth_hash
   request.env['omniauth.auth']
  end

def callback
 if session[:atoken].nil?
  pin = params[:oauth_verifier]
  atoken, asecret = client.authorize_from_request(session[:rtoken], session[:rsecret], pin)
  session[:atoken] = atoken # authentication token
  session[:asecret] = asecret # authentication secret
 else
  client.authorize_from_access(session[:atoken], session[:asecret])
 end
 @profile = client.profile(:fields => [:first_name]).first_name
 @profiles = client.profile(:fields => [:last_name]).last_name  
 @positions = client.profile(:fields => %w(positions)).positions
 @headline = client.profile(:fields => [:headline]).headline
 @educations = client.profile(:fields => [:educations]).educations
 @post = client.add_share({:comment => "blah"})
@user = client.profile(:fields => %w(positions))
@companies = @user.positions.all.map{|t| t.company}
# And if you want the most recent company it can be accessed via companies[0]
 end
end
在我们看来

Headline : <%= @headline %>
</br>
Name : <%= @profile %> <%= @profiles %>
<%= @positions %>
<%= @post %>
<%= @user %>
<%= @educations %>
<%= @companies %>
</br>
<br/>
WELCOME !!!
You have successfully logged in to  through Your LinkedIn Profile !!!
标题:

姓名:

欢迎 您已通过LinkedIn个人资料成功登录到!!!
你说的邮寄是什么意思?你到底想贴什么?我假设您希望发布应用程序中的网络更新。在这种情况下,您需要授予应用程序“rw_nus”权限。只需将该成员权限添加到您的:request\u token\u路径

:request_token_path =>'/uas/oauth/requestToken?scope=r_basicprofile+r_emailaddress+r_network+r_contactinfo+rw_nus'

我应该如何在linkedin中发布?通过这个应用程序?
:request_token_path =>'/uas/oauth/requestToken?scope=r_basicprofile+r_emailaddress+r_network+r_contactinfo+rw_nus'