Sha256: cdfb35813ea583b472783e19e41b8a95affc5d49d79f85d6ccbd94afa6b5a76d

Contents?: true

Size: 702 Bytes

Versions: 13

Compression:

Stored size: 702 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"

# invite user
client.invite_user(email: "name@example.com", group_ids: "41,42")

# invite to a topic
client.invite_user_to_topic(email: "foo@bar.com", topic_id: 1)

# if the user is an admin you may invite to a group as well
client.invite_user_to_topic(email: "foo@bar.com", topic_id: 1, group_ids: "1,2,3")

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
discourse_api-0.46.0 examples/invite_users.rb
discourse_api-0.45.1 examples/invite_users.rb
discourse_api-0.45.0 examples/invite_users.rb
discourse_api-0.44.0 examples/invite_users.rb
discourse_api-0.43.1 examples/invite_users.rb
discourse_api-0.43.0 examples/invite_users.rb
discourse_api-0.42.0 examples/invite_users.rb
discourse_api-0.41.0 examples/invite_users.rb
discourse_api-0.40.0 examples/invite_users.rb
discourse_api-0.39.3 examples/invite_users.rb
discourse_api-0.39.2 examples/invite_users.rb
discourse_api-0.39.1 examples/invite_users.rb
discourse_api-0.39.0 examples/invite_users.rb