_scripts/import_comments.rb
# Converts and sends a comment from the DB to Disqus with the given thread ID
# Failed conversions are stored in @unconverted and the thread_id to URL mapping
# in @threads is updated
Converts and sends a comment from the DB to Disqus with the given thread ID
Failed conversions are stored in @unconverted and the thread_id to URL mapping
in @threads is updated
Converts and sends a comment from the DB to Disqus with the given thread ID Failed conversions are stored in @unconverted and the thread_id to URL mapping in @threads is updated
def post(row, thread_id)
  data = convert(row)
  data[:forum_api_key] = FORUM_KEY
  data[:thread_id] = thread_id
  puts("Sending comment to thread #{thread_id}")
  response = JSON.parse( DISQUS['create_post'].post(data) )
  if response['succeeded']
    @threads[thread_id] = url(row)
  else
    puts "\tWARNING: Could not post comment by #{data[:author_name]} on #{data[:created_at]}"
    puts data.to_yaml + "\n---"
    @unconverted << data
  end
end
def post ( row , thread_id ) data = convert ( row ) data [ :forum_api_key ] = FORUM_KEY data [ :thread_id ] = thread_id puts ( "Sending comment to thread #{thread_id}" ) response = JSON . parse ( DISQUS [ 'create_post' ] . post ( data ) ) if response [ 'succeeded' ] @threads [ thread_id ] = url ( row ) else puts "\tWARNING: Could not post comment by #{data[:author_name]} on #{data[:created_at]}" puts data . to_yaml + "\n---" @unconverted << data end end
Converts and sends a comment from the DB to Disqus with the given thread ID
Failed conversions are stored in @unconverted and the thread_id to URL mapping
in @threads is updated
Converts and sends a comment from the DB to Disqus with the given thread ID Failed conversions are stored in @unconverted and the thread_id to URL mapping in @threads is updated
row
thread_id