There are total 5 pins on the encoders, 3 of them on one side are for rotary encoding which need a simple circuit to supply DC 5V. The remaining 2 pin go short whenever pressed. Please refer to example scheme for more clear understanding.
In the middle of 3 pins' side is COM port connect to GND . And other pins (A and B same side of GND) separate pull to +5v via 10k ohm resisters .
Connect the A and B directly to Arduino IO pins.