lib/beyond_api/resources/users.rb in beyond_api-0.5.1.pre vs lib/beyond_api/resources/users.rb in beyond_api-0.6.0.pre

- old
+ new

@@ -44,11 +44,11 @@ # @option params [Integer] :page the page number # # @return [OpenStruct] # # @example - # session.users.all(params = {}) + # @users = session.users.all(size: 100, page: 0) # def all(params = {}) response, status = BeyondApi::Request.get(@session, "/users") handle_response(response, status) @@ -93,12 +93,10 @@ # -d '{ # "currentPassword" : "GoodPassword01!;)", # "newUsername" : "new username" # }' # - # @beyond_api.scopes ++ - # # @param user_id [String] the user UUID # @param new_username [String] the new username # @param current_password [String] the current password # # @return [OpenStruct] @@ -130,11 +128,16 @@ # @param body [Hash] the request body # # @return [OpenStruct] # # @example - # session.users.create(body) + # body = { + # "username" => "user", + # "password" => "GoodPassword01!;)", + # "email" => "baxter@example.org" + # } + # @user = session.users.create(body) # def create(body) response, status = BeyondApi::Request.post(@session, "/users", body) handle_response(response, status) @@ -195,11 +198,11 @@ # @param user_id [String] the user UUID # # @return [OpenStruct] # # @example - # session.users.find(user_id) + # @user = session.users.find("e4b528ce-bb9e-4cc5-95e1-7dadfa4cf0f3") # def find(user_id) response, status = BeyondApi::Request.get(@session, "/users/#{user_id}") handle_response(response, status) @@ -216,11 +219,11 @@ # @param user_id [String] the user UUID # # @return [OpenStruct] # # @example - # session.users.roles(user_id) + # @roles = session.users.roles("0d4bd0a5-94dc-498e-b6a6-305c619bb20d") # def roles(user_id) response, status = BeyondApi::Request.get(@session, "/users/#{user_id}/roles") handle_response(response, status) @@ -238,11 +241,11 @@ # @param username [String] the user username # # @return [OpenStruct] # # @example - # session.users.search_by_username(username) + # @user = session.users.search_by_username(username) # def search_by_username(username) response, status = BeyondApi::Request.get(@session, "/users/search/find-by-username", username: username) handle_response(response, status) @@ -349,11 +352,11 @@ end # # A +POST+ request is used to verify a password against the password guidelines. # - # $ curl 'https://api-shop.beyondshop.cloud/api/users/verify-password' -i -X POST \ + # $ curl 'https://api-shop.beyondshop.cloud/api/users/verify-password?userRole=merchant' -i -X POST \ # -H 'Content-Type: application/json' \ # -H 'Accept: application/json' \ # -d '{ # "password" : "ValidPassword!" # }' @@ -365,11 +368,11 @@ # @return true # # @example # session.users.verify_password(password) # - def verify_password(password) - response, status = BeyondApi::Request.post(@session, "/users/verify-password", password: password) + def verify_password(password, user_role) + response, status = BeyondApi::Request.post(@session, "/users/verify-password", password: password, user_role: user_role) handle_response(response, status, respond_with_true: true) end end end