HTTParty を使用して Buffer App API を使用して、/updates/createメソッドを介して投稿を追加しようとしていますが、API は私の「テキスト」パラメーターを無視しているようで、エラーが発生します。コマンドラインでcURLを介して実行すると、完全に機能します。これが私のコードです:
class BufferApp
include HTTParty
base_uri 'https://api.bufferapp.com/1'
def initialize(token, id)
@token = token
@id = id
end
def create(text)
BufferApp.post('/updates/create.json', :query => {"text" => text, "profile_ids[]" => @id, "access_token" => @token})
end
end
そして、私は次のようにメソッドを実行しています:
BufferApp.new('{access_token}', '{profile_id}').create('{Text}')
私はdebug_output $stdoutクラスに追加しましたが、投稿はOKのようです:
POST /1/updates/create.json?text=Hello%20there%20why%20is%20this%20not%20working%3F&profile_ids[]={profile_id}&access_token={access_token} HTTP/1.1\r\nConnection: close\r\nHost: api.bufferapp.com\r\n\r\n"
しかし、エラーが発生します。何か不足していますか?