1

Carrierwave を使用して heroku から twitter に更新を投稿しようとしています... メディアを使用しています。

http://rdoc.info/gems/twitter/Twitter/API/Tweets#update_with_media-instance_method

メディアがなくてもできますが、メディアを試すと問題が発生し続けます。

Twitter.update_with_media("message", File.new(picture.picture_url.to_s))

エラーが発生します:

Errno::ENOENT (No such file or directory - https://amazonlinktopicture)

何か案は?File.open も試してみましたが、うまくいきませんでした。

4

4 に答える 4

1
begin    
 twitter_client = Twitter::REST::Client.new do |client|
 client.consumer_key = config['consumer_key']
 client.consumer_secret = config['consumer_secret']
 client.oauth_token = config['oauth_token']
 client.oauth_token_secret = config['oauth_token_secret']
end    
twitter_client.update_with_media(message, open(picture.picture_url))
rescue Exception => exc
  @message = exc.message
end
于 2014-08-21T12:34:52.467 に答える
1
begin    
 twitter_client = Twitter::REST::Client.new do |c|
  c.consumer_key = config['consumer_key']
  c.consumer_secret = config['consumer_secret']
  c.oauth_token = config['oauth_token']
  c.oauth_token_secret = config['oauth_token_secret']
 end    
twitter_client.update_with_media(message, open(picture.picture_url))
rescue Exception => exc
  @message = exc.message
end
于 2014-06-06T13:44:48.297 に答える
1
require 'open-uri'
Twitter.update_with_media("message", open(picture.picture_url.to_s) {|f| f.read })
于 2013-02-06T21:47:27.540 に答える