Sha256: 8b0ea858dbece529a70603ead7be09bf8602c7c373102468497132b6d9b852af
Contents?: true
Size: 1004 Bytes
Versions: 2
Compression:
Stored size: 1004 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: %w[asdf fdsa], )
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
discourse_api-2.0.1 | examples/create_topic.rb |
discourse_api-2.0.0 | examples/create_topic.rb |