Sha256: 0be50d8bea619239e2ad1aa2fd9d4aad0a5e949b6f42d894ff5c2113a9495c4e

Contents?: true

Size: 773 Bytes

Versions: 6

Compression:

Stored size: 773 Bytes

Contents

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

config = DiscourseApi::ExampleHelper.load_yml

client = DiscourseApi::Client.new(config['host'] || 'http://localhost:3000')
client.api_key = config['api_key'] || "YOUR_API_KEY"
client.api_username = config['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

6 entries across 6 versions & 1 rubygems

Version Path
discourse_api-0.41.0 examples/create_topic.rb
discourse_api-0.40.0 examples/create_topic.rb
discourse_api-0.39.3 examples/create_topic.rb
discourse_api-0.39.2 examples/create_topic.rb
discourse_api-0.39.1 examples/create_topic.rb
discourse_api-0.39.0 examples/create_topic.rb