Added credit api and test example.
Refactored credit API in propper clases.
Merge pull request #1 from frepond/master

Added credit API class and test