Sha256: 7075bc2987506e175f2cad7a5de32dd9f973d57fb678d152c4a425088c370820
Contents?: true
Size: 1.28 KB
Versions: 1
Compression:
Stored size: 1.28 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, *args) response = get("/users/#{username}.json", args) response[:body]['user'] end def update_avatar(username, file) put("/users/#{username}/preferences/avatar", { file: file, api_key: api_key }) 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 # Create a user def create_user(args={}) # First retrieve the honeypot values response = get("/users/hp.json") args[:password_confirmation] = response[:body]['value'] args[:challenge] = response[:body]['challenge'].reverse # POST the args post("/users", args) end def log_out_and_refresh_browser(id) post("/admin/users/#{id}/log_out_and_refresh_browser") end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
discourse_api-0.2.5 | lib/discourse_api/api/users.rb |