Amazon-SNS

 view release on metacpan or  search on metacpan

ChangeLog  view on Meta::CPAN

	* v1.2.2
	* Add required version (2010-03-31) field to packets

2015-01-22 Sergey Basmanov
	* v1.2.1
	* Added SNS::Target and MobileAttributes

2013-08-24 Alessandro Zummo
	* v1.2

	* add utf8 support

	* use POST instead of GET, as a side-effect internal signing
	has been implemented and thus Net::Amazon::AWSSign
	is no more required.

	* support different messages for different destinations, the $message
	parameter must be an hashref

	* support Subject in the Publish method

lib/Amazon/SNS.pm  view on Meta::CPAN

		foreach my $attr (keys %{$args->{'Attributes'}}) {
			$args->{$attr} = $args->{'Attributes'}->{$attr};
		}
		delete $args->{'Attributes'};
	}

	# build URI
	my $uri = URI->new($self->service);

	$uri->path('/');
	$uri->query(join('&', map { $_ . '=' . URI::Escape::uri_escape_utf8($args->{$_}, '^A-Za-z0-9\-_.~') } sort keys %$args ));

	# create signature
	$args->{'Signature'} = hmac_sha256_base64(join("\n", 'POST', $uri->host, $uri->path, $uri->query), $self->secret);

	# padding
	while (length($args->{'Signature'}) % 4) {
		$args->{'Signature'} .= '=';
	}

	# rewrite query string
	$uri->query(join('&', map { $_ . '=' . URI::Escape::uri_escape_utf8($args->{$_}, '^A-Za-z0-9\-_.~') } sort keys %$args ));

	my $response = LWP::UserAgent->new->post($self->service, 'Content' => $uri->query);

	$self->status_code($response->code);

	if ($response->is_success) {
		return XMLin($response->content,
				'SuppressEmpty' => 1,
#				'KeyAttr' => { },
				'ForceArray' => [ qw/ Topics member / ],



( run in 0.555 second using v1.01-cache-2.11-cpan-49f99fa48dc )