_scripts/import_comments.rb
# Get the Disqus thread ID for the comment in the DB row
Get the Disqus thread ID for the comment in the DB row
Get the Disqus thread ID for the comment in the DB row
def thread(row) 
  ident_str = "#{row[:post_name]}"
  data = { 
    :forum_api_key => FORUM_KEY,
    :title => row[:post_title], 
    :identifier => ident_str
  }
  response = JSON.parse( DISQUS['thread_by_identifier'].post(data) )
  unless response['succeeded']
    raise "Bad response to get thread ID for #{ident_str}"
  end
  puts "Set thread [#{ident_str}] title to '#{response['message']['thread']['title']}'"
  response['message']['thread']['id']
end
def thread ( row ) ident_str = "#{row[:post_name]}" data = { :forum_api_key => FORUM_KEY , :title => row [ :post_title ] , :identifier => ident_str } response = JSON . parse ( DISQUS [ 'thread_by_identifier' ] . post ( data ) ) unless response [ 'succeeded' ] raise "Bad response to get thread ID for #{ident_str}" end puts "Set thread [#{ident_str}] title to '#{response['message']['thread']['title']}'" response [ 'message' ] [ 'thread' ] [ 'id' ] end
Get the Disqus thread ID for the comment in the DB row
Get the Disqus thread ID for the comment in the DB row
row