Amazon-MWS
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
lib/Amazon/MWS/XML/Product.pm view on Meta::CPAN
has sku => (is => 'ro', required => 1);
has feeds_needed => (is => 'rw', isa => ArrayRef,
default => sub { [qw/product inventory price image variants/] });
sub is_feed_needed {
my ($self, $feed) = @_;
return unless $feed;
return scalar(grep { $_ eq $feed } @{ $self->feeds_needed });
}
has timestamp_string => (is => 'ro',
default => sub { '0' });
has ean => (is => 'ro',
isa => sub { _check_length($_[0], 8, 16) });
has asin => (is => 'ro');
has title => (is => 'ro',
isa => sub { _check_length($_[0], 1, 500) },
);
has description => (is => 'ro',
isa => sub { _check_length($_[0], 0, 2000) },
);
has brand => (is => 'ro',
isa => sub { _check_length($_[0], 0, 50) },
);
has condition => (is => 'ro',
default => sub { 'New' },
isa => sub {
my %condition_map = (
Club => 1,
CollectibleAcceptable => 1,
CollectibleGood => 1,
CollectibleLikeNew => 1,
CollectibleVeryGood => 1,
New => 1,
Refurbished => 1,
UsedAcceptable => 1,
UsedGood => 1,
UsedLikeNew => 1,
UsedVeryGood => 1,
);
my $cond = $_[0];
die "Unrecognized condition $cond, must be one of the following: "
. join(' ', keys %condition_map) unless $condition_map{$cond};
});
has condition_note => (
is => 'ro',
isa => sub { _check_length($_[0], 0, 2000) },
);
has category_code => (is => 'ro');
has product_data => (is => 'ro');
has manufacturer_part_number => (is => 'ro',
isa => sub { _check_length($_[0], 0, 40) }
);
has manufacturer => (is => 'ro',
isa => sub { _check_length($_[0], 0, 50) });
has search_terms => (is => 'ro', isa => ArrayRef);
has features => (is => 'ro', isa => ArrayRef);
sub _check_length {
my ($value, $min, $max) = @_;
if (defined $value) {
die "Max characters is $max" if length($value) > $max;
die "Min characters is $min" if length($value) < $min;
}
}
sub _check_units {
my $unit = $_[0];
my %units = (
GR => 1,
KG => 1,
LB => 1,
MG => 1,
OZ => 1,
);
die "Wrong unit. Possible are :"
. join(" ", keys %units) unless $units{$unit};
}
=over 4
=item package_weight
Weight of the package.
=item package_weight_unit
Unit for the package weight. Possible values are C<GR>, C<KG>, C<LB>,
C<MG>, C<OZ>. Defaults to C<GR>.
=item shipping_weight
Weight of the product when packaged to ship.
=item shipping_weight_unit
Unit for the package weight for shipping. Possible values are C<GR>,
C<KG>, C<LB>, C<MG>, C<OZ>. Defaults to C<GR>.
=back
=cut
has package_weight => (is => 'ro');
has package_weight_unit => (is => 'ro',
default => sub { 'GR' },
isa => \&_check_units,
);
has shipping_weight => (is => 'ro');
has shipping_weight_unit => (is => 'ro',
default => sub { 'GR' },
isa => \&_check_units,
);
view all matches for this distributionview release on metacpan - search on metacpan
( run in 1.153 second using v1.00-cache-2.02-grep-82fe00e-cpan-72ae3ad1e6da )