Sha256: 858d5166c541ef942de2950cc71d010d01918f6650009b74c86567d0398d06f3

Contents?: true

Size: 1003 Bytes

Versions: 12

Compression:

Stored size: 1003 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]"
)

# Create Topic with Tags
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"
  tags: ['asdf', 'fdsa']
)

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
discourse_api-1.1.0 examples/create_topic.rb
discourse_api-1.0.0 examples/create_topic.rb
discourse_api-0.48.1 examples/create_topic.rb
discourse_api-0.48.0 examples/create_topic.rb
discourse_api-0.47.0 examples/create_topic.rb
discourse_api-0.46.0 examples/create_topic.rb
discourse_api-0.45.1 examples/create_topic.rb
discourse_api-0.45.0 examples/create_topic.rb
discourse_api-0.44.0 examples/create_topic.rb
discourse_api-0.43.1 examples/create_topic.rb
discourse_api-0.43.0 examples/create_topic.rb
discourse_api-0.42.0 examples/create_topic.rb