Amazon-MWS
view release on metacpan or search on metacpan
lib/Amazon/MWS/Uploader.pm view on Meta::CPAN
get stuck on the Amazon's side processing, so database credentials
have to be provided (or the database handle itself).
The table structure needed is defined and commented in sql/amazon.sql
=head1 SYNOPSIS
my $agent = Amazon::MWS::Uploader->new(
db_dsn => 'DBI:mysql:database=XXX',
db_username => 'xxx',
db_password => 'xxx',
db_options => \%options
# or dbh => $dbh,
schema_dir => '/path/to/xml_schema',
feed_dir => '/path/to/directory/for/xml',
merchant_id => 'xxx',
access_key_id => 'xxx',
secret_key => 'xxx',
lib/Amazon/MWS/Uploader.pm view on Meta::CPAN
=item dbh
The DBI handle. If not provided will be built using the following
self-describing accessor:
=item db_dsn
=item db_username
=item db_password
=item db_options
E.g.
{
mysql_enable_utf8 => 1,
}
AutoCommit and RaiseError are set by us.
=cut
has db_dsn => (is => 'ro');
has db_password => (is => 'ro');
has db_username => (is => 'ro');
has db_options => (is => 'ro',
isa => AnyOf[Undef,HashRef],
);
has dbh => (is => 'lazy');
=item skus_warnings_modes
Determines how to treat warnings. This is a hash reference with the
code of the warning as key and one of the following modes as value:
lib/Amazon/MWS/Uploader.pm view on Meta::CPAN
has quiet => (is => 'ro');
sub _build_dbh {
my $self = shift;
my $dsn = $self->db_dsn;
die "Missing dns" unless $dsn;
my $options = $self->db_options || {};
# forse raise error and auto-commit
$options->{RaiseError} = 1;
$options->{AutoCommit} = 1;
my $dbh = DBI->connect($dsn, $self->db_username, $self->db_password,
$options) or die "Couldn't connect to $dsn!";
return $dbh;
}
=item purge_missing_products
If true, the first time C<products_to_upload> is called, products not
passed to the C<products> constructor will be purged from the
C<amazon_mws_products> table. Default to false.
t/job-selection.t view on Meta::CPAN
merchant_id => '__MERCHANT_ID__',
shop_id => 'shoppe',
access_key_id => '12341234',
secret_key => '123412341234',
marketplace_id => '123412341234',
endpoint => 'https://mws-eu.amazonservices.com',
feed_dir => $feed_dir,
schema_dir => 'schemas',
db_dsn => 'dbi:SQLite:dbname=t/test.db',
db_username => '',
db_password => '',
);
my $uploader = Amazon::MWS::Uploader->new(%constructor);
ok ($uploader->dbh);
my $create_table =<<'SQL';
CREATE TABLE amazon_mws_jobs (
amws_job_id VARCHAR(64) NOT NULL,
shop_id VARCHAR(64) NOT NULL,
( run in 1.118 second using v1.01-cache-2.11-cpan-49f99fa48dc )