lib/bearcat/client/users.rb in bearcat-1.4.13 vs lib/bearcat/client/users.rb in bearcat-1.5.0.beta1

- old
+ new

@@ -1,37 +1,30 @@ module Bearcat class Client < Footrest::Client module Users + extend ClientModule - def list_users(account, params={}) - get("/api/v1/accounts/#{account.to_s}/users", params) + prefix "/api/v1/accounts/:account/users/" do + get :list_users + post :add_user end - def user_avatars(user, params={}) - get("/api/v1/users/#{user.to_s}/avatars", params) + prefix "/api/v1/users/" do + prefix ":user/" do + get :user_detail + get :user_avatars, "avatars" + get :user_profile, "profile" + get :user_logins, "logins" + get :communication_channels, "communication_channels" + get :page_views, "page_views" + put :user_merge, "merge_into/:merge_into_user" + get :user_assignments, "courses/:course/assignments" + get :dashboard_positions, "dashboard_positions" + put :update_dashboard_positions, "dashboard_positions" + end end - def add_user(account, params={}) - post("/api/v1/accounts/#{account.to_s}/users", params) - end - - def user_detail(user, params={}) - get("/api/v1/users/#{user.to_s}", params) - end - - def user_profile(user, params={}) - get("/api/v1/users/#{user.to_s}/profile", params) - end - - def user_logins(user, params={}) - get("/api/v1/users/#{user.to_s}/logins", params) - end - - def communication_channels(user, params={}) - get("/api/v1/users/#{user.to_s}/communication_channels", params) - end - # scope: food # params: {ns: 'com.account-domain.canvas-app'} # returns all custom user food scope data. If no scope returns all custom user data def load_custom_data(user, params, scope = '') get("/api/v1/users/#{user}/custom_data/#{scope}", params) @@ -48,29 +41,9 @@ # scope: food # params: {ns: 'com.account-domain.canvas-app'} # deletes all custom user data for the food scope. If no scope deletes all custom user data def delete_custom_data(user, params, scope = '') delete("/api/v1/users/#{user}/custom_data/#{scope}", params) - end - - def page_views(user, params = {}) - get("/api/v1/users/#{user}/page_views", params) - end - - def user_merge(user, merge_into_user) - put("/api/v1/users/#{user}/merge_into/#{merge_into_user}") - end - - def user_assignments(user, course, params = {}) - get("/api/v1/users/#{user}/courses/#{course}/assignments", params) - end - - def dashboard_positions(user, params = {}) - get("/api/v1/users/#{user}/dashboard_positions", params) - end - - def update_dashboard_positions(user, params = {}) - put("/api/v1/users/#{user}/dashboard_positions", params) end def favorite_courses(user, params = {}) params.merge!({as_user_id: user}) get("/api/v1/users/self/favorites/courses", params)