--- trunk/Nos.pm 2005/05/17 21:37:06 38 +++ trunk/Nos.pm 2005/05/17 22:23:40 39 @@ -463,6 +463,105 @@ return $lists->search({ name => $name })->first; } +### +### SOAP +### + +package Nos::SOAP; + +=head1 SOAP methods + +This methods are thin wrappers to provide SOAP calls. They are grouped in +C package which is in same F module file. + +Usually, you want to use named variables in your SOAP calls if at all +possible. + +However, if you have broken SOAP library (like PHP SOAP class from PEAR) +you will want to use positional arguments (in same order as documented for +methods below). + +=cut + +my $nos; + +sub new { + my $class = shift; + my $self = {@_}; + bless($self, $class); + + $nos = new Nos( @_ ) || die "can't create Nos object"; + + $self ? return $self : return undef; +} + + +=head2 NewList + + $message_id = NewList( + list => 'My list', + email => 'my-list@example.com' + ); + +=cut + +sub NewList { + my $self = shift; + + if ($_[0] !~ m/^HASH/) { + return $nos->new_list( + list => $_[0], email => $_[1], + ); + } else { + return $nos->new_list( %{ shift @_ } ); + } +} + +=head2 AddMemberToList + + $member_id = AddMemberToList( + list => "My list", + email => "e-mail@example.com", + name => "Full Name" + ); + +=cut + +sub AddMemberToList { + my $self = shift; + + if ($_[0] !~ m/^HASH/) { + return $nos->add_member_to_list( + list => $_[0], email => $_[1], name => $_[2], + ); + } else { + return $nos->add_member_to_list( %{ shift @_ } ); + } +} + +=head2 AddMessageToList + + $message_id = AddMessageToList( + list => 'My list', + message => 'From: My list...' + ); + +=cut + +sub AddMessageToList { + my $self = shift; + + if ($_[0] !~ m/^HASH/) { + return $nos->add_message_to_list( + list => $_[0], message => $_[1], + ); + } else { + return $nos->add_message_to_list( %{ shift @_ } ); + } +} + + +### =head1 EXPORT @@ -488,3 +587,5 @@ =cut + +1;