Sha256: 0112da67c6b4494150cd4a695c4fe97a193350765685266e0bc3bca1bc1f9eb3

Contents?: true

Size: 661 Bytes

Versions: 3

Compression:

Stored size: 661 Bytes

Contents

# frozen_string_literal: true
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require File.expand_path('../../lib/discourse_api', __FILE__)

client = DiscourseApi::Client.new("http://localhost:3000")
client.api_key = "YOUR_API_KEY"
client.api_username = "YOUR_USERNAME"

client.create_topic(
  category: 1,
  skip_validations: true,
  auto_track: false,
  title: "Concert Master: A new way to choose",
  raw: "This is the raw markdown for my post"
)

# create Poll topic
client.create_topic(
  category: 2,
  skip_validations: false,
  auto_track: false,
  title: "Your Favorite Color?",
  raw: "[poll name=color]\n- Green\n- Blue\n- Red\n[/poll]"
)

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
discourse_api-0.38.0 examples/create_topic.rb
discourse_api-0.37.0 examples/create_topic.rb
discourse_api-0.36.0 examples/create_topic.rb