Sha256: c7d0bd90a0390390433f18c59d9d3f1d2d83c88455a94a4ed71561ade386eb2c
Contents?: true
Size: 1.83 KB
Versions: 1
Compression:
Stored size: 1.83 KB
Contents
module DiscourseApi module API module Users def activate(id) put "/admin/users/#{id}/activate", api_key: api_key, api_username: api_username end def user(username, params={}) response = get("/users/#{username}.json", params) response[:body]['user'] end def update_avatar(args) args = API.params(args) .required(:username, :file) .default(image_type: 'avatar') .to_h upload_response = post("/users/#{args[:username]}/preferences/user_image", args) put("/users/#{args[:username]}/preferences/avatar/pick", { upload_id: upload_response['upload_id'] }) end def update_email(username, email) put("/users/#{username}/preferences/email", { email: email, api_key: api_key }) end def update_user(username, params={}) put("/users/#{username}", params) end def update_username(username, new_username) put("/users/#{username}/preferences/username", { new_username: new_username, api_key: api_key }) end def update_trust_level(args) args = API.params(args) .required(:user_id, :level) .to_h response = put("/admin/users/#{args[:user_id]}/trust_level", args) response[:body] end def create_user(args) args = API.params(args) .required(:name, :email, :password, :username) .optional(:active) .to_h post("/users", args) end def log_out(id) post("/admin/users/#{id}/log_out") end def invite_admin(args={}) post("/admin/users/invite_admin", args) end def list_users(type) response = get("admin/users/list/#{type}.json") response[:body] end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
discourse_api-0.4.0 | lib/discourse_api/api/users.rb |