This is a demo app built on the perl web framework: Catalyst.
It flexes many aspects of the myGengo API and can be used for local (mock) testing as well as sandbox access.
The app is based on the WebService::MyGengo API library and the Catalyst::Model::WebService::MyGengo module.
- You have access to a browser supported by jQuery
- You are installing on a UNIX-like environment
- You have perl 5.10.1+ installed
- You are using local::lib, or you don't mind if Catalyst installs a bunch of perl modules on your system.
- If you have questions about any of the above, drop me a line!
- Install cpanminus
- This is a great package installer that should make the rest of the installation much smoother
- If you are asked whether to install a dependency, always answer yes
cpan -i App::cpanminus
- Download and install CataGengo
wget -O - 'https://github.com/nheinric/CataGengo/tarball/master' | tar xz -
cd nheinric-* && cpanm --installdeps .
perl Makefile.PL && make && make test
- NOTE:
make install
is not necessary!
- Done!
In mock mode, all requests will be handled by a local object that mimics the action of the sandbox.
No requests to the real sandbox will be made, so you can test to your heart's content without worrying about throttling.
However, if you stop/start the server, all of your test Jobs will vanish.
- Run the local server:
CATAGENGO_HOME=. ./script/catagengo_server.pl -d
- Open http://127.0.0.1:3000/mygengo in your browser of choice
- Click the 'Create a New Job' tab to make a Job
- Test to your heart's content!
- Note: your credits in the 'Account' tab will not decrease. This is considered a feature, as you can test forever!
If you make a lot of requests the sandbox may begin to throttle you (which manifests as all requests resulting in an "authentication didn't pass" error.)
If this happens you'll need to wait awhile (not sure how long...) until you can test again.
-
Open catagengo.conf. It will look like the following:
<Model::MyGengo> # class WebService::MyGengo::Client class CataGengo::Test::Util::Client public_key pubkey private_key privkey use_sandbox 1 </Model::MyGengo>
-
Swap the commented
class
lines so they look like this:<Model::MyGengo> class WebService::MyGengo::Client # class CataGengo::Test::Util::Client public_key pubkey private_key privkey use_sandbox 1 </Model::MyGengo>
-
Replace 'pubkey' and 'privkey' with your sandbox API public and private keys
- If you have any "#" characters in your keys, you must escape them with a backslash: \#
- Save the file and run the local server:
CATAGENGO_HOME=. ./script/catagengo_server.pl -d
- Open http://127.0.0.1:3000/mygengo in your browser of choice
- Click the 'Jobs' tab to view your Jobs in the sandbox
- If you have a lot of Jobs, the page will take awhile to load the first time
- Subsequent loads will be quicker because the Job list is cached internally
- If you update a Job in the sandbox, open the Job list or Job details click the 'Refresh Data' button to refresh data from the API
Live mode works exactly like Sandbox mode, only you'll be interacting with the production myGengo server.
YOU WILL BE CHARGED FOR NEW JOBS CREATED IN THIS MODE!
- Open catagengo.conf again and:
- Change your public/private keys to your production API keys
- Change
use_sandbox
to 0 - Save the file and run the local server:
CATAGENGO_HOME=. ./script/catagengo_server.pl -d
Feel free to contact me at nheinric-at-cpan.org if you hit any snags!