Amazon-MWS

 view release on metacpan or  search on metacpan

lib/Amazon/MWS/XML/Response/FeedSubmissionResult.pm  view on Meta::CPAN

package Amazon::MWS::XML::Response::FeedSubmissionResult;

use strict;
use warnings;
use XML::Compile::Schema;
use Data::Dumper;

use Moo;
use MooX::Types::MooseLike::Base qw(:all);

use namespace::clean;

=head1 NAME

Amazon::MWS::XML::Response::FeedSubmissionResult -- response parser

=head1 SYNOPSIS

  my $res = Amazon::MWS::XML::Response::FeedSubmissionResult->new(xml => $xml);
  if ($res->is_success) { ... };

=head1 ACCESSOR

=head2 xml

The xml string

=head2 xml_reader

A sub reference with the AmazonEnvelope reader.

=head2 structure

Lazy attribute built via parsing the xml string passed at the constructor.

=head1 METHODS

=head2 is_success

=head2 errors

=head2 report_errors

A list of error messages, where each element is an hashref with this keys:

=over 4

=item code (numeric)

=item type (warning or error)

=item message (human-readable)

=back

=cut

has xml => (is => 'ro', required => '1');
has xml_reader => (is => 'ro',
                   required => 1);
has structure => (is => 'lazy');

sub _build_structure {
    my $self = shift;
    my $struct = $self->xml_reader->($self->xml);
    die "not a processing report xml" unless $struct->{MessageType} eq 'ProcessingReport';



( run in 0.658 second using v1.01-cache-2.11-cpan-75ffa21a3d4 )