| 1 | package Net::Zuora::ZObject; | ||
| 2 | use strict; | ||
| 3 | use warnings; | ||
| 4 | use Moose (); | ||
| 5 | use Moose::Exporter; | ||
| 6 | |||
| 7 | Moose::Exporter->setup_import_methods( | ||
| 8 | also => 'Moose', | ||
| 9 | ); | ||
| 10 | |||
| 11 | sub init_meta { | ||
| 12 | shift; | ||
| 13 | my %options = @_; | ||
| 14 | Moose->init_meta( %options ); | ||
| 15 | Moose::Util::MetaRole::apply_metaclass_roles( | ||
| 16 | for_class => $options{for_class}, | ||
| 17 | attribute_metaclass_roles => [ | ||
| 18 | 'Net::Zuora::ZObject::AttributeRole', | ||
| 19 | ], | ||
| 20 | metaclass_roles => [qw/ | ||
| 21 | Net::Zuora::ZObject::MetaClassRole | ||
| 22 | /], | ||
| 23 | constructor_class_roles => [qw/ | ||
| 24 | MooseX::StrictConstructor::Role::Meta::Method::Constructor | ||
| 25 | /], | ||
| 26 | ); | ||
| 27 | Moose::Util::MetaRole::apply_base_class_roles( | ||
| 28 | for_class => $options{for_class}, | ||
| 29 | roles => [qw/ | ||
| 30 | MooseX::StrictConstructor::Role::Object | ||
| 31 | Net::Zuora::ZObject::Role | ||
| 32 | /], | ||
| 33 | ); | ||
| 34 | return $options{for_class}->meta; | ||
| 35 | } | ||
| 36 | |||
| 37 | 1; | ||
| 38 | |||
| 39 | =head1 NAME | ||
| 40 | |||
| 41 | Net::Zuora::ZObject - Moose role representing an object in the Zuora system | ||
| 42 | |||
| 43 | =head1 DESCRIPTION | ||
| 44 | |||
| 45 | This is a base L<Moose::Role|role> which all objects that are represented | ||
| 46 | in the Zuora API consume. | ||
| 47 | |||
| 48 | =head1 METHODS | ||
| 49 | |||
| 50 | =head2 create | ||
| 51 | |||
| 52 | Creates an object which does not exist already in the Zuora's API. | ||
| 53 | |||
| 54 | Throws an exception if the object could not be created for any reason. | ||
| 55 | |||
| 56 | =head2 update | ||
| 57 | |||
| 58 | Pushes any local updates to this object back to Zuora's API. | ||
| 59 | |||
| 60 | Throws an exception if the object could not be updated for any reason. | ||
| 61 | |||
| 62 | =head1 ZUORA DOCS | ||
| 63 | |||
| 64 | L<http://apidocs.developer.zuora.com/index.php/ZObject> | ||
| 65 | |||
| 66 | =head1 AUTHOR | ||
| 67 | |||
| 68 | See L<Net::Zuora> for author information | ||
| 69 | |||
| 70 | =head1 COPYRIGHT & LICENSE | ||
| 71 | |||
| 72 | See L<Net::Zuora> for copyright and license information. | ||
| 73 | |||
| 74 | =cut | ||
| 75 |