examples/controllers/user_controller.rb in api-client-1.7.0 vs examples/controllers/user_controller.rb in api-client-1.7.1
- old
+ new
@@ -3,6 +3,31 @@
# Your action should looks like any other one: A model with a method call. =D
def index
@users = User.get("api.example.com/users")
respond_with(@users)
end
-end
\ No newline at end of file
+
+ def new
+ @user = User.new
+ respond_with(@user)
+ end
+
+ def create
+ @user = User.post("api.example.com/users", :user => params[:user])
+ respond_with(@user)
+ end
+
+ def edit
+ @user = User.get("api.example.com/users/#{params[:id]}")
+ respond_with(@user)
+ end
+
+ def update
+ @user = User.patch("api.example.com/users", { :id => params[:id], :user => params[:user]})
+ respond_with(@user)
+ end
+
+ def show
+ @user = User.get("api.example.com/users/#{params[:id]}")
+ respond_with(@user)
+ end
+end