Hereは、それは今あなたがそれを使用しようとしている、あなたはトークンとomniauthから秘密を持っているので、あなたが必要な正確に何であるので:
def prepare_access_token(oauth_token, oauth_token_secret)
consumer = OAuth::Consumer.new("APIKey", "APISecret", { :site => "https://api.twitter.com", :request_token_path => '/oauth/request_token', :access_token_path => '/oauth/access_token', :authorize_path => '/oauth/authorize', :scheme => :header })
token_hash = { :oauth_token => oauth_token, :oauth_token_secret => oauth_token_secret } access_token = OAuth::AccessToken.from_hash(consumer, token_hash)
return access_token
end
次に、あなたは、例えば、ポストつぶやき:
msg = {'status' => 'Hey look I can tweet via OAuth!'}
access_token = prepare_access_token(token, secret)
response = access_token.post('https://api.twitter.com/1/statuses/update.json', msg, { 'Accept' => 'application/xml' })
詳細については、リンク先の記事をお読みください。
これは私のために働いてくれてありがとう – santosh