| 1 | package Catalyst::Model::WebService::MyGengo; | ||
| 2 | |||
| 3 | 1 | ▶ | use 5.008004; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 1 | ▶ | use Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 1 | ▶ | use namespace::autoclean; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | |||
| 7 | 1 | extends 'Catalyst::Model::Factory::PerRequest'; | |
| 8 | |||
| 9 | 1 | our $VERSION = '0.002'; | |
| 10 | |||
| 11 | =head1 NAME | ||
| 12 | |||
| 13 | Catalyst::Model::WebService::MyGengo - Catalyst Model providing access to the L<WebService::MyGengo> library | ||
| 14 | |||
| 15 | =head1 SYNOPSIS | ||
| 16 | |||
| 17 | In your model class: | ||
| 18 | |||
| 19 | package MyApp::Model::MyGengo; | ||
| 20 | |||
| 21 | use strict; | ||
| 22 | use parent qw( Catalyst::Model::WebService::MyGengo ); | ||
| 23 | |||
| 24 | __PACKAGE__->config({ | ||
| 25 | class => 'WebService::MyGengo::Client' | ||
| 26 | , public_key => 'your API public key' | ||
| 27 | , private_key => 'your API private key' | ||
| 28 | , use_sandbox => 0 # Whether to use the production site or the sandbox | ||
| 29 | # See WebService::MyGengo::Client for other options | ||
| 30 | }); | ||
| 31 | |||
| 32 | 1; | ||
| 33 | |||
| 34 | Or in your myapp.conf or myapp_local.conf file ( be sure to escape any # | ||
| 35 | characters in your keys (eg \#) ): | ||
| 36 | |||
| 37 | <Model::MyGengo> | ||
| 38 | class WebService::MyGengo::Client | ||
| 39 | public_key my-sandbox-pubkey | ||
| 40 | private_key my-sandbox-privkey | ||
| 41 | use_sandbox 1 | ||
| 42 | </Model::MyGengo> | ||
| 43 | |||
| 44 | Then, in a controller: | ||
| 45 | |||
| 46 | # Grab a WebService::MyGengo::Job | ||
| 47 | my $job = $c->model('MyGengo')->get_job( 123 ); | ||
| 48 | |||
| 49 | # Add comments, etc. | ||
| 50 | $job = $c->model('MyGengo')->add_job_comment( $job, "Nicey nice nice!" ); | ||
| 51 | |||
| 52 | =head1 SEE ALSO | ||
| 53 | |||
| 54 | L<http://mygengo.com> | ||
| 55 | |||
| 56 | L<WebService::MyGengo::Client> | ||
| 57 | |||
| 58 | L<Catalyst::Model::Factory::PerRequest> | ||
| 59 | |||
| 60 | =head1 AUTHOR | ||
| 61 | |||
| 62 | Nathaniel Heinrichs | ||
| 63 | |||
| 64 | =head1 LICENSE | ||
| 65 | |||
| 66 | Copyright (c) 2011, Nathaniel Heinrichs <nheinric-at-cpan.org>. | ||
| 67 | All rights reserved. | ||
| 68 | |||
| 69 | This library is free software. You can redistribute it and/or modify | ||
| 70 | it under the same terms as Perl itself. | ||
| 71 | |||
| 72 | =cut | ||
| 73 | |||
| 74 | 1 | __PACKAGE__->meta->make_immutable; | |
| 75 | 1 | 1; | |