Adjusting code sample to the new api 

I've tried to use and discovered that the api is changed.
Just adjusting the sample.
Merge pull request #1 from nbluis/patch-1

Adjusting code sample to the new api