12345678910111213141516171819202122232425262728293031 |
- ## rails ##
- x rake db:drop && x rake db:migrate && rake db:seed && x rake db:test:prepare && rails c
- ## curl ##
- NAME='CurlChannel'
- BASE_URL=http://localhost:3000/clients
- NICKS='NickA,NickB'
- NICK='NickA'
- CLIENT_SECRET='' # via create client resp - required for auth
- ROOM_SECRET='' # via 'fetch rooms' resp - bridges ("rooms") other than own
- # - required to merge into other bridge (own secret is useless here)
- # create client (returns own CLIENT_SECRET and own ROOM_SECRET)
- curl -H "Content-Type: application/json" -H "Accept: application/json" -X POST -d "{\"client\":{\"name\":\"$NAME\",\"nicks\":\"$NICKS\",\"type\":\"IrcClient\"}}" $BASE_URL/
- # fetch rooms (returns other ROOM_SECRETS)
- curl -H "Content-Type: application/json" -H "Accept: application/json" -X POST -d "{\"client\":{\"secret\":\"$CLIENT_SECRET\"}}" $BASE_URL/$NAME/rooms
- # join bridge
- curl -H "Content-Type: application/json" -H "Accept: application/json" -X POST -d "{\"client\":{\"secret\":\"$CLIENT_SECRET\"},\"room_secret\":\"$ROOM_SECRET\"}" $BASE_URL/$NAME/bridge
- # create message
- curl -H "Content-Type: application/json" -H "Accept: application/json" -X POST -d "{\"client\":{\"secret\":\"$CLIENT_SECRET\"},\"message\":{\"nick\":\"$NICK\",\"text\":\"some text\"}}" $BASE_URL/$NAME/message
- # read messages
- curl -H "Content-Type: application/json" -H "Accept: application/json" -X POST -d "{\"client\":{\"secret\":\"$CLIENT_SECRET\"},\"last_id\":0}" $BASE_URL/$NAME/messages
|