Created
July 30, 2015 17:43
-
-
Save vabruzzo/bb2c1bf9429d4cfb7353 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/local/bin/ruby | |
| # posting to a topic | |
| require('/path/to/discourse_api/gem') | |
| client = DiscourseApi::Client.new("https://push-language.hampshire.edu") | |
| client.api_key = "YOUR_API_KEY" | |
| client.api_username = "slack_archive" | |
| response = client.create_post( | |
| topic_id: 101, | |
| raw: "this is the raw text of a post created using the discourse_api Ruby gem" | |
| ) | |
| puts response | |
| ################################################################################ | |
| #!/usr/local/bin/ruby | |
| # creating a topic | |
| require('/path/to/discourse_api/gem') | |
| client = DiscourseApi::Client.new("https://push-language.hampshire.edu") | |
| client.api_key = "YOUR_API_KEY" | |
| client.api_username = "slack_archive" | |
| response = client.create_topic( | |
| category: "Slack Archives", | |
| skip_validations: true, | |
| auto_track: false, | |
| title: "discourse API test topic", | |
| raw: "this is the text of the tet topic" | |
| ) | |
| puts response |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment