) = @_;
my $self = bless {}, $class;
$param{server} ||= 'https://rest.nexmo.com/sms/json';
for my $attr ( @attrs ) {
if ( exists $param{$attr} ) {
$self->$at
use Nexmo::SMS;
my $nexmo = Nexmo::SMS->new(
server => 'https://rest.nexmo.com/sms/json',
username => 'testuser1',
password => 'testpasswd2',
);
my $sms = $
eate a new object
my $foo = Nexmo::SMS->new(
server => 'https://rest.nexmo.com/sms/json',
username => 'testuser1',
password => 'testpasswd2',
);
Those parameters ar
use Nexmo::SMS::Response::Message;
my $nexmo = Nexmo::SMS::Response::Message->new(
json => '{
"status":"4",
"message-id":"message001",
"client-
THODS
=head2 new
create a new object
my $foo = Nexmo::SMS::Response::Message->new(
json => '
{
"status":"4",
"message-id":"message001",
MS::BinaryMessage;
use strict;
use warnings;
use Nexmo::SMS::Response;
use LWP::UserAgent;
use JSON::PP;
# ABSTRACT: Module that respresents a binary message for the Nexmo SMS API!
our $VERSION =
f $response;
return;
}
my $json = $response->content;
my $response_object = Nexmo::SMS::Response->new( json => $json );
if ( $response_object->is_error ) {
;
my $nexmo = Nexmo::SMS::BinaryMessage->new(
server => 'http://rest.nexmo.com/sms/json',
username => 'testuser1',
password => 'testpasswd2',
text => 'This i
package Nexmo::SMS::GetBalance;
use strict;
use warnings;
use LWP::UserAgent;
use JSON::PP;
# ABSTRACT: Module to ask for the balance for the Nexmo SMS API!
our $VERSION = '0.02';
my %attrs = (
ept' => 'application/json' );
my $response = $ua->get(
$url,
);
if ( !$response || !$response->is_success ) {
return;
}
my $json = $response->conten
t;
my $coder = JSON::PP->new->utf8->pretty->allow_nonref;
my $perl = $coder->decode( $json );
return if !$perl || ref $perl ne 'HASH';
return $perl->{'value'};
}
1;
__END_
::Response;
use JSON::PP;
use strict;
use warnings;
no warnings 'redefine';
our $VERSION = 0.01;
*LWP::UserAgent::post = sub {
my ($object,$url,$params) = @_;
my $json = do{ undef $/;
<DATA> };
my $coder = JSON::PP->new->ascii->pretty->allow_nonref;
my $perl = $coder->decode( $json );
my $from = $params->{from};
if ( $url =~ /get-balance/ ) {
$f
,$url,$params) = @_;
my $json = do{ undef $/; <DATA> };
my $coder = JSON::PP->new->ascii->pretty->allow_nonref;
my $perl = $coder->decode( $json );
my $from = $params->{fro
MS::Response::Message;
use JSON::PP;
# ABSTRACT: Module that represents a response from Nexmo SMS API!
our $VERSION = '0.01';
# create getter/setter
my @attrs = qw(json message_count status);
for
return $self if !$param{json};
# decode json
my $coder = JSON::PP->new->utf8->pretty->allow_nonref;
my $perl = $coder->decode( $param{json} );
$self->message_count
se from Nexmo.
use Nexmo::SMS::Response;
my $nexmo = Nexmo::SMS::Response->new(
json => '{
"message-count":"1",
"messages":[
{
"st
S::WAPPushMessage;
use strict;
use warnings;
use Nexmo::SMS::Response;
use LWP::UserAgent;
use JSON::PP;
# ABSTRACT: Module that respresents a WAPPush message for the Nexmo SMS API!
our $VERSION
f $response;
return;
}
my $json = $response->content;
my $response_object = Nexmo::SMS::Response->new( json => $json );
if ( $response_object->is_error ) {
my $nexmo = Nexmo::SMS::WAPPushMessage->new(
server => 'http://rest.nexmo.com/sms/json',
username => 'testuser1',
password => 'testpasswd2',
text => 'This i
:SMS::TextMessage;
use strict;
use warnings;
use Nexmo::SMS::Response;
use LWP::UserAgent;
use JSON::PP;
# ABSTRACT: Module that respresents a text message for the Nexmo SMS API!
our $VERSION = '
f $response;
return;
}
my $json = $response->content;
my $response_object = Nexmo::SMS::Response->new( json => $json );
if ( $response_object->is_error ) {
ge;
my $nexmo = Nexmo::SMS::TextMessage->new(
server => 'http://rest.nexmo.com/sms/json',
username => 'testuser1',
password => 'testpasswd2',
text => 'This i