The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.
Changes 2336
LICENSE 11
MANIFEST 01
META.yml 812
Makefile.PL 1617
README 24
dist.ini 1110
lib/Nexmo/SMS/BinaryMessage.pm 11987
lib/Nexmo/SMS/GetBalance.pm 8953
lib/Nexmo/SMS/MockLWP.pm 445
lib/Nexmo/SMS/Response/Message.pm 6326
lib/Nexmo/SMS/Response.pm 10673
lib/Nexmo/SMS/TextMessage.pm 11886
lib/Nexmo/SMS/WAPPushMessage.pm 12087
lib/Nexmo/SMS.pm 14779
15 files changed (This is a version diff) 867577
@@ -1,23 +1,36 @@
-Revision history for Nexmo-SMS
-
-0.06    Dec 26, 2011 - "Belfast"
-        + changed handling of unicode messages
-        + replaced dummy server url with real server url
-
-0.05    Nov 30, 2011 - "Paris"
-        + forget to mention the "type" attribute in UnicodeMessage
-
-0.04    Nov 25, 2011 - "Munich"
-        + add support for unicode messages (thanks Jui-Nan Lin)
-        + fix linefeeds
-
-0.03    Aug 28, 2011 - "Amsterdam"
-        + add support for get_balance()
-
-0.02    Aug 28, 2011 - "London"
-        + Support WAPPush and Binary messages
-        + more tests
-
-0.01    Aug 17, 2011 - "Riga"
-        First version, released on an unsuspecting world.
-
+Revision history for Nexmo-SMS
+==============================
+
+0.07    2015-01-18 
+
+        [MISC]
+        + add metaresources to dist.ini
+        + update format of Changes file
+
+0.06    2011-12-26
+
+        + changed handling of unicode messages
+        + replaced dummy server url with real server url
+
+0.05    2011-11-30
+
+        + forget to mention the "type" attribute in UnicodeMessage
+
+0.04    2011-11-25
+
+        + add support for unicode messages (thanks Jui-Nan Lin)
+        + fix linefeeds
+
+0.03    2011-08-28
+
+        + add support for get_balance()
+
+0.02    2011-08-28
+
+        + Support WAPPush and Binary messages
+        + more tests
+
+0.01    2011-08-17
+
+        First version, released on an unsuspecting world.
+
@@ -1,4 +1,4 @@
-This software is Copyright (c) 2011 by Renee Baecker.
+This software is Copyright (c) 2015 by Renee Baecker.
 
 This is free software, licensed under:
 
@@ -1,3 +1,4 @@
+# This file was automatically generated by Dist::Zilla::Plugin::Manifest v5.029.
 Changes
 LICENSE
 MANIFEST
@@ -1,19 +1,23 @@
 ---
 abstract: 'Module for the Nexmo SMS API!'
 author:
-  - 'Renee Baecker <module@renee-baecker.de>'
+  - 'Renee Baecker <reneeb@cpan.org>'
 build_requires: {}
 configure_requires:
-  ExtUtils::MakeMaker: 6.30
+  ExtUtils::MakeMaker: '0'
 dynamic_config: 0
-generated_by: 'Dist::Zilla version 4.300003, CPAN::Meta::Converter version 2.112621'
+generated_by: 'Dist::Zilla version 5.029, CPAN::Meta::Converter version 2.142060'
 license: artistic_2
 meta-spec:
   url: http://module-build.sourceforge.net/META-spec-v1.4.html
-  version: 1.4
+  version: '1.4'
 name: Nexmo-SMS
 requires:
-  HTTP::Response: 5.836
-  JSON::PP: 2.26000
-  LWP::UserAgent: 5.835
-version: 0.06
+  HTTP::Response: '5.836'
+  JSON::PP: '2.26000'
+  LWP::UserAgent: '5.835'
+resources:
+  bugtracker: http://github.com/reneeb/perl-Nexmo-SMS/issues
+  homepage: http://github.com/reneeb/perl-Nexmo-SMS
+  repository: http://github.com/reneeb/perl-Nexmo-SMS.git
+version: '0.07'
@@ -1,19 +1,19 @@
 
+# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v5.029.
 use strict;
 use warnings;
 
 
 
-use ExtUtils::MakeMaker 6.30;
+use ExtUtils::MakeMaker;
 
 
 
 my %WriteMakefileArgs = (
   "ABSTRACT" => "Module for the Nexmo SMS API!",
-  "AUTHOR" => "Renee Baecker <module\@renee-baecker.de>",
-  "BUILD_REQUIRES" => {},
+  "AUTHOR" => "Renee Baecker <reneeb\@cpan.org>",
   "CONFIGURE_REQUIRES" => {
-    "ExtUtils::MakeMaker" => "6.30"
+    "ExtUtils::MakeMaker" => 0
   },
   "DISTNAME" => "Nexmo-SMS",
   "EXE_FILES" => [],
@@ -24,24 +24,25 @@ my %WriteMakefileArgs = (
     "JSON::PP" => "2.26000",
     "LWP::UserAgent" => "5.835"
   },
-  "VERSION" => "0.06",
+  "VERSION" => "0.07",
   "test" => {
     "TESTS" => "t/*.t"
   }
 );
 
 
-unless ( eval { ExtUtils::MakeMaker->VERSION(6.56) } ) {
-  my $br = delete $WriteMakefileArgs{BUILD_REQUIRES};
-  my $pp = $WriteMakefileArgs{PREREQ_PM};
-  for my $mod ( keys %$br ) {
-    if ( exists $pp->{$mod} ) {
-      $pp->{$mod} = $br->{$mod} if $br->{$mod} > $pp->{$mod};
-    }
-    else {
-      $pp->{$mod} = $br->{$mod};
-    }
-  }
+my %FallbackPrereqs = (
+  "ExtUtils::MakeMaker" => 0,
+  "HTTP::Response" => "5.836",
+  "JSON::PP" => "2.26000",
+  "LWP::UserAgent" => "5.835"
+);
+
+
+unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) {
+  delete $WriteMakefileArgs{TEST_REQUIRES};
+  delete $WriteMakefileArgs{BUILD_REQUIRES};
+  $WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs;
 }
 
 delete $WriteMakefileArgs{CONFIGURE_REQUIRES}
@@ -1,14 +1,16 @@
 
 
 This archive contains the distribution Nexmo-SMS,
-version 0.06:
+version 0.07:
 
   Module for the Nexmo SMS API!
 
-This software is Copyright (c) 2011 by Renee Baecker.
+This software is Copyright (c) 2015 by Renee Baecker.
 
 This is free software, licensed under:
 
   The Artistic License 2.0 (GPL Compatible)
 
 
+This README file was generated by Dist::Zilla::Plugin::Readme v5.029.
+
@@ -1,21 +1,20 @@
 name    = Nexmo-SMS
-author  = Renee Baecker <module@renee-baecker.de>
+author  = Renee Baecker <reneeb@cpan.org>
 license = Artistic_2_0
 copyright_holder = Renee Baecker
-copyright_year   = 2011
+copyright_year   = 2015
 
 [VersionFromModule]
 
-[PodWeaver]
+[@Basic]
+[@Git]
 
-[GatherDir]
-[MetaYAML]
-[MakeMaker]
-[Manifest]
-[Readme]
-[License]
-
-[UploadToCPAN]
+[MetaResources]
+homepage = http://github.com/reneeb/perl-Nexmo-SMS
+bugtracker.web = http://github.com/reneeb/perl-Nexmo-SMS/issues
+repository.url = http://github.com/reneeb/perl-Nexmo-SMS.git
+repository.web = http://github.com/reneeb/perl-Nexmo-SMS
+repository.type = git
 
 [Prereqs]
 JSON::PP = 2.26000
@@ -10,7 +10,6 @@ use JSON::PP;
 
 # ABSTRACT: Module that respresents a binary message for the Nexmo SMS API!
 
-
 our $VERSION = '0.02';
 
 my %attrs = (
@@ -38,6 +37,55 @@ for my $attr ( keys %attrs ) {
     };
 }
 
+=head1 SYNOPSIS
+
+This module simplifies sending SMS through the Nexmo API.
+
+
+    use Nexmo::SMS::BinaryMessage;
+
+    my $nexmo = Nexmo::SMS::BinaryMessage->new(
+        server   => 'http://rest.nexmo.com/sms/json',
+        username => 'testuser1',
+        password => 'testpasswd2',
+        text     => 'This is a test',
+        from     => 'Test02',
+        to       => '452312432',
+    );
+        
+    my $response = $sms->send || die $sms->errstr;
+    
+    if ( $response->is_success ) {
+        print "SMS was sent...\n";
+    }
+
+=head1 METHODS
+
+=head2 new
+
+create a new object
+
+    my $message = Nexmo::SMS::BinaryMessage->new(
+        server   => 'http://rest.nexmo.com/sms/json',
+        username => 'testuser1',
+        password => 'testpasswd2',
+    );
+
+This method recognises these parameters:
+
+    body              => 'required',
+    udh               => 'required',
+    type              => 'required',
+    from              => 'required',
+    to                => 'required',
+    server            => 'required',
+    username          => 'required',
+    password          => 'required',
+    status_report_req => 'optional',
+    client_ref        => 'optional',
+    network_code      => 'optional',
+
+=cut
 
 sub new {
     my ($class,%param) = @_;
@@ -59,6 +107,16 @@ sub new {
     return $self;
 }
 
+=head2 user_agent
+
+Getter/setter for the user_agent attribute of the object. By default a new
+object of LWP::UserAgent is used, but you can use your own class as long as it
+is compatible to LWP::UserAgent.
+
+  $sms->user_agent( MyUserAgent->new );
+  my $ua = $sms->user_agent;
+
+=cut
 
 sub user_agent {
     my ($self,$ua) = @_;
@@ -67,6 +125,13 @@ sub user_agent {
     return $self->{__ua__};
 }
 
+=head2 errstr
+
+return the "last" error as string.
+
+    print $sms->errstr;
+
+=cut
 
 sub errstr {
     my ($self,$message) = @_;
@@ -75,6 +140,15 @@ sub errstr {
     return $self->{__errstr__};
 }
 
+=head2 send
+
+This actually calls the Nexmo SMS API. It returns a L<Nexmo::SMS::Response> object or
+C<undef> (on failure).
+
+   my $sms = Nexmo::SMS::BinaryMessage->new( ... );
+   $sms->send or die $sms->errstr;
+
+=cut
 
 sub send {
     my ($self) = shift;
@@ -114,6 +188,16 @@ sub send {
     return $response_object;
 }
 
+=head2 check_needed_params
+
+This method checks if all needed parameters are passed.
+
+  my $params_not_ok = Nexmo::SMS::BinaryMessage->check_needed_params( ... );
+  if ( $params_not_ok ) {
+      print "Please check $params_not_ok";
+  }
+
+=cut
 
 sub check_needed_params {
     my ($class,%params) = @_;
@@ -129,104 +213,6 @@ sub check_needed_params {
     return join ", ", @params_not_ok;
 }
 
-
-1;
-
-
-__END__
-=pod
-
-=head1 NAME
-
-Nexmo::SMS::BinaryMessage - Module that respresents a binary message for the Nexmo SMS API!
-
-=head1 VERSION
-
-version 0.06
-
-=head1 SYNOPSIS
-
-This module simplifies sending SMS through the Nexmo API.
-
-    use Nexmo::SMS::BinaryMessage;
-
-    my $nexmo = Nexmo::SMS::BinaryMessage->new(
-        server   => 'http://rest.nexmo.com/sms/json',
-        username => 'testuser1',
-        password => 'testpasswd2',
-        text     => 'This is a test',
-        from     => 'Test02',
-        to       => '452312432',
-    );
-        
-    my $response = $sms->send || die $sms->errstr;
-    
-    if ( $response->is_success ) {
-        print "SMS was sent...\n";
-    }
-
-=head1 VERSION
-
-Version 0.02
-
-=head1 METHODS
-
-=head2 new
-
-create a new object
-
-    my $message = Nexmo::SMS::BinaryMessage->new(
-        server   => 'http://rest.nexmo.com/sms/json',
-        username => 'testuser1',
-        password => 'testpasswd2',
-    );
-
-This method recognises these parameters:
-
-    body              => 'required',
-    udh               => 'required',
-    type              => 'required',
-    from              => 'required',
-    to                => 'required',
-    server            => 'required',
-    username          => 'required',
-    password          => 'required',
-    status_report_req => 'optional',
-    client_ref        => 'optional',
-    network_code      => 'optional',
-
-=head2 user_agent
-
-Getter/setter for the user_agent attribute of the object. By default a new
-object of LWP::UserAgent is used, but you can use your own class as long as it
-is compatible to LWP::UserAgent.
-
-  $sms->user_agent( MyUserAgent->new );
-  my $ua = $sms->user_agent;
-
-=head2 errstr
-
-return the "last" error as string.
-
-    print $sms->errstr;
-
-=head2 send
-
-This actually calls the Nexmo SMS API. It returns a L<Nexmo::SMS::Response> object or
-C<undef> (on failure).
-
-   my $sms = Nexmo::SMS::BinaryMessage->new( ... );
-   $sms->send or die $sms->errstr;
-
-=head2 check_needed_params
-
-This method checks if all needed parameters are passed.
-
-  my $params_not_ok = Nexmo::SMS::BinaryMessage->check_needed_params( ... );
-  if ( $params_not_ok ) {
-      print "Please check $params_not_ok";
-  }
-
 =head1 Attributes
 
 These attributes are available for C<Nexmo::SMS::TextMessage> objects:
@@ -257,25 +243,7 @@ These attributes are available for C<Nexmo::SMS::TextMessage> objects:
 
 =back
 
-=head1 ACKNOWLEDGEMENTS
-
-=head1 COPYRIGHT & LICENSE
-
-Copyright 2011 Renee Baecker.
-
-This program is released under the following license: artistic_2
-
-=head1 AUTHOR
-
-Renee Baecker <module@renee-baecker.de>
-
-=head1 COPYRIGHT AND LICENSE
-
-This software is Copyright (c) 2011 by Renee Baecker.
-
-This is free software, licensed under:
-
-  The Artistic License 2.0 (GPL Compatible)
-
 =cut
 
+1;
+
@@ -8,7 +8,6 @@ use JSON::PP;
 
 # ABSTRACT: Module to ask for the balance for the Nexmo SMS API!
 
-
 our $VERSION = '0.02';
 
 my %attrs = (
@@ -28,6 +27,40 @@ for my $attr ( keys %attrs ) {
     };
 }
 
+=head1 SYNOPSIS
+
+This module simplifies sending SMS through the Nexmo API.
+
+
+    use Nexmo::SMS::GetBalance;
+
+    my $nexmo = Nexmo::SMS::GetBalance->new(
+        server   => 'http://rest.nexmo.com/sms/json',
+        username => 'testuser1',
+        password => 'testpasswd2',
+    );
+        
+    my $balance = $sms->get_balance;
+
+=head1 METHODS
+
+=head2 new
+
+create a new object
+
+    my $object = Nexmo::SMS::GetBalance->new(
+        server   => 'http://rest.nexmo.com/sms/json',
+        username => 'testuser1',
+        password => 'testpasswd2',
+    );
+
+This method recognises these parameters:
+
+    server            => 'required',
+    username          => 'required',
+    password          => 'required',
+
+=cut
 
 sub new {
     my ($class,%param) = @_;
@@ -49,6 +82,16 @@ sub new {
     return $self;
 }
 
+=head2 user_agent
+
+Getter/setter for the user_agent attribute of the object. By default a new
+object of LWP::UserAgent is used, but you can use your own class as long as it
+is compatible to LWP::UserAgent.
+
+  $sms->user_agent( MyUserAgent->new );
+  my $ua = $sms->user_agent;
+
+=cut
 
 sub user_agent {
     my ($self,$ua) = @_;
@@ -57,12 +100,17 @@ sub user_agent {
     return $self->{__ua__};
 }
 
+=head2 get_balance
+
+This actually calls the Nexmo SMS API. It returns the balance of the account.
+
+   my $balance = $object->get_balance;
+
+=cut
 
 sub get_balance {
     my ($self) = shift;
     
-    use Data::Dumper;
-    
     my $url = sprintf "%saccount/get-balance/%s/%s",
         $self->server,
         $self->username,
@@ -87,72 +135,6 @@ sub get_balance {
     return $perl->{'value'};
 }
 
-
-1;
-
-
-__END__
-=pod
-
-=head1 NAME
-
-Nexmo::SMS::GetBalance - Module to ask for the balance for the Nexmo SMS API!
-
-=head1 VERSION
-
-version 0.06
-
-=head1 SYNOPSIS
-
-This module simplifies sending SMS through the Nexmo API.
-
-    use Nexmo::SMS::GetBalance;
-
-    my $nexmo = Nexmo::SMS::GetBalance->new(
-        server   => 'http://rest.nexmo.com/sms/json',
-        username => 'testuser1',
-        password => 'testpasswd2',
-    );
-        
-    my $balance = $sms->get_balance;
-
-=head1 VERSION
-
-Version 0.02
-
-=head1 METHODS
-
-=head2 new
-
-create a new object
-
-    my $object = Nexmo::SMS::GetBalance->new(
-        server   => 'http://rest.nexmo.com/sms/json',
-        username => 'testuser1',
-        password => 'testpasswd2',
-    );
-
-This method recognises these parameters:
-
-    server            => 'required',
-    username          => 'required',
-    password          => 'required',
-
-=head2 user_agent
-
-Getter/setter for the user_agent attribute of the object. By default a new
-object of LWP::UserAgent is used, but you can use your own class as long as it
-is compatible to LWP::UserAgent.
-
-  $sms->user_agent( MyUserAgent->new );
-  my $ua = $sms->user_agent;
-
-=head2 get_balance
-
-This actually calls the Nexmo SMS API. It returns the balance of the account.
-
-   my $balance = $object->get_balance;
-
 =head1 Attributes
 
 These attributes are available for C<Nexmo::SMS::GetBalance> objects. For each
@@ -171,25 +153,7 @@ attribute there is a getter/setter:
 
 =back
 
-=head1 ACKNOWLEDGEMENTS
-
-=head1 COPYRIGHT & LICENSE
-
-Copyright 2011 Renee Baecker.
-
-This program is released under the following license: artistic_2
-
-=head1 AUTHOR
-
-Renee Baecker <module@renee-baecker.de>
-
-=head1 COPYRIGHT AND LICENSE
-
-This software is Copyright (c) 2011 by Renee Baecker.
-
-This is free software, licensed under:
-
-  The Artistic License 2.0 (GPL Compatible)
-
 =cut
 
+1;
+
@@ -2,6 +2,11 @@ package Nexmo::SMS::MockLWP;
 
 # ABSTRACT: Module for the Nexmo SMS API!
 
+=head1 DESCRIPTION
+
+This module mocks POST requests. It exists only for the unit tests!
+
+=cut
 
 use LWP::UserAgent;
 use HTTP::Response;
@@ -62,50 +67,6 @@ our $VERSION = 0.01;
 
 1;
 
-
-
-
-=pod
-
-=head1 NAME
-
-Nexmo::SMS::MockLWP - Module for the Nexmo SMS API!
-
-=head1 VERSION
-
-version 0.06
-
-=head1 DESCRIPTION
-
-This module mocks POST requests. It exists only for the unit tests!
-
-=head1 VERSION
-
-Version 0.01
-
-=head1 ACKNOWLEDGEMENTS
-
-=head1 COPYRIGHT & LICENSE
-
-Copyright 2011 Renee Baecker.
-
-This program is released under the following license: artistic_2
-
-=head1 AUTHOR
-
-Renee Baecker <module@renee-baecker.de>
-
-=head1 COPYRIGHT AND LICENSE
-
-This software is Copyright (c) 2011 by Renee Baecker.
-
-This is free software, licensed under:
-
-  The Artistic License 2.0 (GPL Compatible)
-
-=cut
-
-
 __DATA__
 {
     "http://rest.nexmo.com/sms/json" : {
@@ -5,7 +5,6 @@ use warnings;
 
 # ABSTRACT: Module that represents a single message in the response from Nexmo SMS API!
 
-
 our $VERSION = '0.02';
 
 # create getter/setter
@@ -41,46 +40,11 @@ my %status_map = (
     12 => [ 'Message too long',	'Applies to Binary submissions, where the length of the UDF and the message body combined exceed 140 octets' ],
 );
 
-
-sub new {
-    my ($class,%param) = @_;
-    
-    my $self = bless {}, $class;
-    
-    for my $attr ( @attrs ) {
-        (my $key = $attr) =~ tr/_/-/;
-        $self->$attr( $param{$key} );
-    }
-    
-    my $status = $param{status};
-    
-    if ( exists $status_map{$status} ) {
-        my $info = $status_map{$status};
-        $self->status_text( $info->[0] );
-        $self->status_desc( $info->[1] );
-    }
-    
-    return $self;
-}
-
-1;
-
-
-__END__
-=pod
-
-=head1 NAME
-
-Nexmo::SMS::Response::Message - Module that represents a single message in the response from Nexmo SMS API!
-
-=head1 VERSION
-
-version 0.06
-
 =head1 SYNOPSIS
 
 This module represents a single message in a response from Nexmo.
 
+
     use Nexmo::SMS::Response::Message;
 
     my $nexmo = Nexmo::SMS::Response::Message->new(
@@ -96,10 +60,6 @@ This module represents a single message in a response from Nexmo.
     
     print $nexmo->message_price;
 
-=head1 VERSION
-
-Version 0.02
-
 =head1 METHODS
 
 =head2 new
@@ -118,6 +78,31 @@ create a new object
               }',
     );
 
+=cut
+
+sub new {
+    my ($class,%param) = @_;
+    
+    my $self = bless {}, $class;
+    
+    for my $attr ( @attrs ) {
+        (my $key = $attr) =~ tr/_/-/;
+        $self->$attr( $param{$key} );
+    }
+    
+    my $status = $param{status};
+    
+    if ( exists $status_map{$status} ) {
+        my $info = $status_map{$status};
+        $self->status_text( $info->[0] );
+        $self->status_desc( $info->[1] );
+    }
+    
+    return $self;
+}
+
+1;
+
 =head1 ATTRIBUTES
 
 These attributes are available for C<Nexmo::SMS::TextMessage> objects:
@@ -143,25 +128,3 @@ These attributes are available for C<Nexmo::SMS::TextMessage> objects:
 
 =back
 
-=head1 ACKNOWLEDGEMENTS
-
-=head1 COPYRIGHT & LICENSE
-
-Copyright 2011 Renee Baecker.
-
-This program is released under the following license: artistic_2
-
-=head1 AUTHOR
-
-Renee Baecker <module@renee-baecker.de>
-
-=head1 COPYRIGHT AND LICENSE
-
-This software is Copyright (c) 2011 by Renee Baecker.
-
-This is free software, licensed under:
-
-  The Artistic License 2.0 (GPL Compatible)
-
-=cut
-
@@ -9,7 +9,6 @@ use JSON::PP;
 
 # ABSTRACT: Module that represents a response from Nexmo SMS API!
 
-
 our $VERSION = '0.01';
 
 # create getter/setter
@@ -26,89 +25,11 @@ for my $attr ( @attrs ) {
     };
 }
 
-
-sub new {
-    my ($class,%param) = @_;
-    
-    my $self = bless {}, $class;
-    
-    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( $perl->{'message-count'} );
-    $self->status( 0 );
-    
-    # for each message create a new message object
-    for my $message ( @{ $perl->{messages} || [] } ) {
-        $self->_add_message(
-            Nexmo::SMS::Response::Message->new( %{$message || {}} )
-        );
-    }
-    
-    return $self;
-}
-
-
-sub messages {
-    my ($self) = @_;
-    
-    return @{ $self->{__messages__} || [] };
-}
-
-sub _add_message {
-    my ($self,$message) = @_;
-    
-    if ( @_ == 2 and $message->isa( 'Nexmo::SMS::Response::Message' ) ) {
-        push @{$self->{__messages__}}, $message;
-        if ( $message->status != 0 ) {
-            $self->status(1);
-            $self->errstr( $message->status_text . ' (' . $message->status_desc . ')' );
-        }
-    }
-}
-
-
-
-sub errstr {
-    my ($self,$message) = @_;
-    
-    $self->{__errstr__} = $message if @_ == 2;
-    return $self->{__errstr__};
-}
-
-
-sub is_success {
-    my ($self) = @_;
-    return !$self->status;
-}
-
-
-sub is_error {
-    my ($self) = @_;
-    return $self->status;
-}
-
-1;
-
-
-__END__
-=pod
-
-=head1 NAME
-
-Nexmo::SMS::Response - Module that represents a response from Nexmo SMS API!
-
-=head1 VERSION
-
-version 0.06
-
 =head1 SYNOPSIS
 
 This module represents a response from Nexmo.
 
+
     use Nexmo::SMS::Response;
 
     my $nexmo = Nexmo::SMS::Response->new(
@@ -131,10 +52,6 @@ This module represents a response from Nexmo.
         print $message->status;
     }
 
-=head1 VERSION
-
-Version 0.01
-
 =head1 METHODS
 
 =head2 new
@@ -157,6 +74,32 @@ create a new object
         }',
     );
 
+=cut
+
+sub new {
+    my ($class,%param) = @_;
+    
+    my $self = bless {}, $class;
+    
+    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( $perl->{'message-count'} );
+    $self->status( 0 );
+    
+    # for each message create a new message object
+    for my $message ( @{ $perl->{messages} || [] } ) {
+        $self->_add_message(
+            Nexmo::SMS::Response::Message->new( %{$message || {}} )
+        );
+    }
+    
+    return $self;
+}
+
 =head2 messages
 
 returns the list of messages included in the response. Each element is an
@@ -164,20 +107,66 @@ object of L<Nexmo::SMS::Response::Message>.
 
     my @messages = $response->messages;
 
+=cut
+
+sub messages {
+    my ($self) = @_;
+    
+    return @{ $self->{__messages__} || [] };
+}
+
+sub _add_message {
+    my ($self,$message) = @_;
+    
+    if ( @_ == 2 and $message->isa( 'Nexmo::SMS::Response::Message' ) ) {
+        push @{$self->{__messages__}}, $message;
+        if ( $message->status != 0 ) {
+            $self->status(1);
+            $self->errstr( $message->status_text . ' (' . $message->status_desc . ')' );
+        }
+    }
+}
+
 =head2 errstr
 
 return the "last" error as string.
 
     print $response->errstr;
 
+=cut
+
+
+sub errstr {
+    my ($self,$message) = @_;
+    
+    $self->{__errstr__} = $message if @_ == 2;
+    return $self->{__errstr__};
+}
+
 =head2 is_success
 
 returns 1 if all messages have a status = 0, C<undef> otherwise.
 
+=cut
+
+sub is_success {
+    my ($self) = @_;
+    return !$self->status;
+}
+
 =head2 is_error
 
 Returns 1 if an error occured, 0 otherwise...
 
+=cut
+
+sub is_error {
+    my ($self) = @_;
+    return $self->status;
+}
+
+1;
+
 =head1 ATTRIBUTES
 
 These attributes are available for C<Nexmo::SMS::TextMessage> objects:
@@ -195,25 +184,3 @@ These attributes are available for C<Nexmo::SMS::TextMessage> objects:
 
 =back
 
-=head1 ACKNOWLEDGEMENTS
-
-=head1 COPYRIGHT & LICENSE
-
-Copyright 2011 Renee Baecker.
-
-This program is released under the following license: artistic_2
-
-=head1 AUTHOR
-
-Renee Baecker <module@renee-baecker.de>
-
-=head1 COPYRIGHT AND LICENSE
-
-This software is Copyright (c) 2011 by Renee Baecker.
-
-This is free software, licensed under:
-
-  The Artistic License 2.0 (GPL Compatible)
-
-=cut
-
@@ -10,7 +10,6 @@ use JSON::PP;
 
 # ABSTRACT: Module that respresents a text message for the Nexmo SMS API!
 
-
 our $VERSION = '0.02';
 
 my %attrs = (
@@ -37,6 +36,54 @@ for my $attr ( keys %attrs ) {
     };
 }
 
+=head1 SYNOPSIS
+
+This module simplifies sending SMS through the Nexmo API.
+
+
+    use Nexmo::SMS::TextMessage;
+
+    my $nexmo = Nexmo::SMS::TextMessage->new(
+        server   => 'http://rest.nexmo.com/sms/json',
+        username => 'testuser1',
+        password => 'testpasswd2',
+        text     => 'This is a test',
+        from     => 'Test02',
+        to       => '452312432',
+    );
+        
+    my $response = $sms->send || die $sms->errstr;
+    
+    if ( $response->is_success ) {
+        print "SMS was sent...\n";
+    }
+
+=head1 METHODS
+
+=head2 new
+
+create a new object
+
+    my $message = Nexmo::SMS::TextMessage->new(
+        server   => 'http://rest.nexmo.com/sms/json',
+        username => 'testuser1',
+        password => 'testpasswd2',
+    );
+
+This method recognises these parameters:
+
+    text              => 'required',
+    from              => 'required',
+    to                => 'required',
+    server            => 'required',
+    username          => 'required',
+    password          => 'required',
+    type              => 'optional',
+    status_report_req => 'optional',
+    client_ref        => 'optional',
+    network_code      => 'optional',
+
+=cut
 
 sub new {
     my ($class,%param) = @_;
@@ -58,6 +105,16 @@ sub new {
     return $self;
 }
 
+=head2 user_agent
+
+Getter/setter for the user_agent attribute of the object. By default a new
+object of LWP::UserAgent is used, but you can use your own class as long as it
+is compatible to LWP::UserAgent.
+
+  $sms->user_agent( MyUserAgent->new );
+  my $ua = $sms->user_agent;
+
+=cut
 
 sub user_agent {
     my ($self,$ua) = @_;
@@ -66,6 +123,13 @@ sub user_agent {
     return $self->{__ua__};
 }
 
+=head2 errstr
+
+return the "last" error as string.
+
+    print $sms->errstr;
+
+=cut
 
 sub errstr {
     my ($self,$message) = @_;
@@ -74,6 +138,15 @@ sub errstr {
     return $self->{__errstr__};
 }
 
+=head2 send
+
+This actually calls the Nexmo SMS API. It returns a L<Nexmo::SMS::Response> object or
+C<undef> (on failure).
+
+   my $sms = Nexmo::SMS::TextMessage->new( ... );
+   $sms->send or die $sms->errstr;
+
+=cut
 
 sub send {
     my ($self) = shift;
@@ -112,6 +185,16 @@ sub send {
     return $response_object;
 }
 
+=head2 check_needed_params
+
+This method checks if all needed parameters are passed.
+
+  my $params_not_ok = Nexmo::SMS::TextMessage->check_needed_params( ... );
+  if ( $params_not_ok ) {
+      print "Please check $params_not_ok";
+  }
+
+=cut
 
 sub check_needed_params {
     my ($class,%params) = @_;
@@ -127,103 +210,6 @@ sub check_needed_params {
     return join ", ", @params_not_ok;
 }
 
-
-1;
-
-
-__END__
-=pod
-
-=head1 NAME
-
-Nexmo::SMS::TextMessage - Module that respresents a text message for the Nexmo SMS API!
-
-=head1 VERSION
-
-version 0.06
-
-=head1 SYNOPSIS
-
-This module simplifies sending SMS through the Nexmo API.
-
-    use Nexmo::SMS::TextMessage;
-
-    my $nexmo = Nexmo::SMS::TextMessage->new(
-        server   => 'http://rest.nexmo.com/sms/json',
-        username => 'testuser1',
-        password => 'testpasswd2',
-        text     => 'This is a test',
-        from     => 'Test02',
-        to       => '452312432',
-    );
-        
-    my $response = $sms->send || die $sms->errstr;
-    
-    if ( $response->is_success ) {
-        print "SMS was sent...\n";
-    }
-
-=head1 VERSION
-
-Version 0.02
-
-=head1 METHODS
-
-=head2 new
-
-create a new object
-
-    my $message = Nexmo::SMS::TextMessage->new(
-        server   => 'http://rest.nexmo.com/sms/json',
-        username => 'testuser1',
-        password => 'testpasswd2',
-    );
-
-This method recognises these parameters:
-
-    text              => 'required',
-    from              => 'required',
-    to                => 'required',
-    server            => 'required',
-    username          => 'required',
-    password          => 'required',
-    type              => 'optional',
-    status_report_req => 'optional',
-    client_ref        => 'optional',
-    network_code      => 'optional',
-
-=head2 user_agent
-
-Getter/setter for the user_agent attribute of the object. By default a new
-object of LWP::UserAgent is used, but you can use your own class as long as it
-is compatible to LWP::UserAgent.
-
-  $sms->user_agent( MyUserAgent->new );
-  my $ua = $sms->user_agent;
-
-=head2 errstr
-
-return the "last" error as string.
-
-    print $sms->errstr;
-
-=head2 send
-
-This actually calls the Nexmo SMS API. It returns a L<Nexmo::SMS::Response> object or
-C<undef> (on failure).
-
-   my $sms = Nexmo::SMS::TextMessage->new( ... );
-   $sms->send or die $sms->errstr;
-
-=head2 check_needed_params
-
-This method checks if all needed parameters are passed.
-
-  my $params_not_ok = Nexmo::SMS::TextMessage->check_needed_params( ... );
-  if ( $params_not_ok ) {
-      print "Please check $params_not_ok";
-  }
-
 =head1 Attributes
 
 These attributes are available for C<Nexmo::SMS::TextMessage> objects:
@@ -252,25 +238,7 @@ These attributes are available for C<Nexmo::SMS::TextMessage> objects:
 
 =back
 
-=head1 ACKNOWLEDGEMENTS
-
-=head1 COPYRIGHT & LICENSE
-
-Copyright 2011 Renee Baecker.
-
-This program is released under the following license: artistic_2
-
-=head1 AUTHOR
-
-Renee Baecker <module@renee-baecker.de>
-
-=head1 COPYRIGHT AND LICENSE
-
-This software is Copyright (c) 2011 by Renee Baecker.
-
-This is free software, licensed under:
-
-  The Artistic License 2.0 (GPL Compatible)
-
 =cut
 
+1;
+
@@ -10,7 +10,6 @@ use JSON::PP;
 
 # ABSTRACT: Module that respresents a WAPPush message for the Nexmo SMS API!
 
-
 our $VERSION = '0.02';
 
 my %attrs = (
@@ -39,6 +38,55 @@ for my $attr ( keys %attrs ) {
     };
 }
 
+=head1 SYNOPSIS
+
+This module simplifies sending SMS through the Nexmo API.
+
+    use Nexmo::SMS::WAPPushMessage;
+
+    my $nexmo = Nexmo::SMS::WAPPushMessage->new(
+        server   => 'http://rest.nexmo.com/sms/json',
+        username => 'testuser1',
+        password => 'testpasswd2',
+        text     => 'This is a test',
+        from     => 'Test02',
+        to       => '452312432',
+    );
+        
+    my $response = $sms->send || die $sms->errstr;
+    
+    if ( $response->is_success ) {
+        print "SMS was sent...\n";
+    }
+
+=head1 METHODS
+
+=head2 new
+
+create a new object
+
+    my $message = Nexmo::SMS::WAPPushMessage->new(
+        server   => 'http://rest.nexmo.com/sms/json',
+        username => 'testuser1',
+        password => 'testpasswd2',
+    );
+
+This method recognises these parameters:
+
+    title             => 'required',
+    url               => 'required',
+    type              => 'required',
+    from              => 'required',
+    to                => 'required',
+    server            => 'required',
+    username          => 'required',
+    password          => 'required',
+    status_report_req => 'optional',
+    client_ref        => 'optional',
+    network_code      => 'optional',
+    validity          => 'optional',
+
+=cut
 
 sub new {
     my ($class,%param) = @_;
@@ -60,6 +108,16 @@ sub new {
     return $self;
 }
 
+=head2 user_agent
+
+Getter/setter for the user_agent attribute of the object. By default a new
+object of LWP::UserAgent is used, but you can use your own class as long as it
+is compatible to LWP::UserAgent.
+
+  $sms->user_agent( MyUserAgent->new );
+  my $ua = $sms->user_agent;
+
+=cut
 
 sub user_agent {
     my ($self,$ua) = @_;
@@ -68,6 +126,13 @@ sub user_agent {
     return $self->{__ua__};
 }
 
+=head2 errstr
+
+return the "last" error as string.
+
+    print $sms->errstr;
+
+=cut
 
 sub errstr {
     my ($self,$message) = @_;
@@ -76,6 +141,15 @@ sub errstr {
     return $self->{__errstr__};
 }
 
+=head2 send
+
+This actually calls the Nexmo SMS API. It returns a L<Nexmo::SMS::Response> object or
+C<undef> (on failure).
+
+   my $sms = Nexmo::SMS::WAPPushMessage->new( ... );
+   $sms->send or die $sms->errstr;
+
+=cut
 
 sub send {
     my ($self) = shift;
@@ -116,6 +190,16 @@ sub send {
     return $response_object;
 }
 
+=head2 check_needed_params
+
+This method checks if all needed parameters are passed.
+
+  my $params_not_ok = Nexmo::SMS::WAPPushMessage->check_needed_params( ... );
+  if ( $params_not_ok ) {
+      print "Please check $params_not_ok";
+  }
+
+=cut
 
 sub check_needed_params {
     my ($class,%params) = @_;
@@ -131,105 +215,6 @@ sub check_needed_params {
     return join ", ", @params_not_ok;
 }
 
-
-1;
-
-
-__END__
-=pod
-
-=head1 NAME
-
-Nexmo::SMS::WAPPushMessage - Module that respresents a WAPPush message for the Nexmo SMS API!
-
-=head1 VERSION
-
-version 0.06
-
-=head1 SYNOPSIS
-
-This module simplifies sending SMS through the Nexmo API.
-
-    use Nexmo::SMS::WAPPushMessage;
-
-    my $nexmo = Nexmo::SMS::WAPPushMessage->new(
-        server   => 'http://rest.nexmo.com/sms/json',
-        username => 'testuser1',
-        password => 'testpasswd2',
-        text     => 'This is a test',
-        from     => 'Test02',
-        to       => '452312432',
-    );
-        
-    my $response = $sms->send || die $sms->errstr;
-    
-    if ( $response->is_success ) {
-        print "SMS was sent...\n";
-    }
-
-=head1 VERSION
-
-Version 0.02
-
-=head1 METHODS
-
-=head2 new
-
-create a new object
-
-    my $message = Nexmo::SMS::WAPPushMessage->new(
-        server   => 'http://rest.nexmo.com/sms/json',
-        username => 'testuser1',
-        password => 'testpasswd2',
-    );
-
-This method recognises these parameters:
-
-    title             => 'required',
-    url               => 'required',
-    type              => 'required',
-    from              => 'required',
-    to                => 'required',
-    server            => 'required',
-    username          => 'required',
-    password          => 'required',
-    status_report_req => 'optional',
-    client_ref        => 'optional',
-    network_code      => 'optional',
-    validity          => 'optional',
-
-=head2 user_agent
-
-Getter/setter for the user_agent attribute of the object. By default a new
-object of LWP::UserAgent is used, but you can use your own class as long as it
-is compatible to LWP::UserAgent.
-
-  $sms->user_agent( MyUserAgent->new );
-  my $ua = $sms->user_agent;
-
-=head2 errstr
-
-return the "last" error as string.
-
-    print $sms->errstr;
-
-=head2 send
-
-This actually calls the Nexmo SMS API. It returns a L<Nexmo::SMS::Response> object or
-C<undef> (on failure).
-
-   my $sms = Nexmo::SMS::WAPPushMessage->new( ... );
-   $sms->send or die $sms->errstr;
-
-=head2 check_needed_params
-
-This method checks if all needed parameters are passed.
-
-  my $params_not_ok = Nexmo::SMS::WAPPushMessage->check_needed_params( ... );
-  if ( $params_not_ok ) {
-      print "Please check $params_not_ok";
-  }
-
 =head1 Attributes
 
 These attributes are available for C<Nexmo::SMS::TextMessage> objects:
@@ -262,25 +247,7 @@ These attributes are available for C<Nexmo::SMS::TextMessage> objects:
 
 =back
 
-=head1 ACKNOWLEDGEMENTS
-
-=head1 COPYRIGHT & LICENSE
-
-Copyright 2011 Renee Baecker.
-
-This program is released under the following license: artistic_2
-
-=head1 AUTHOR
-
-Renee Baecker <module@renee-baecker.de>
-
-=head1 COPYRIGHT AND LICENSE
-
-This software is Copyright (c) 2011 by Renee Baecker.
-
-This is free software, licensed under:
-
-  The Artistic License 2.0 (GPL Compatible)
-
 =cut
 
+1;
+
@@ -11,10 +11,49 @@ use Nexmo::SMS::GetBalance;
 
 # ABSTRACT: Module for the Nexmo SMS API!
 
+our $VERSION = '0.07';
 
-our $VERSION = '0.06';
 
+=head1 SYNOPSIS
+
+This module simplifies sending SMS through the Nexmo API.
+
+
+    use Nexmo::SMS;
+
+    my $nexmo = Nexmo::SMS->new(
+        server   => 'http://rest.nexmo.com/sms/json',
+        username => 'testuser1',
+        password => 'testpasswd2',
+    );
+    
+    my $sms = $nexmo->sms(
+        text     => 'This is a test',
+        from     => 'Test02',
+        to       => '452312432',
+    ) or die $nexmo->errstr;
+    
+    my $response = $sms->send || die $sms->errstr;
+    
+    if ( $response->is_success ) {
+        print "SMS was sent...\n";
+    }
 
+=head1 METHODS
+
+=head2 new
+
+create a new object
+
+    my $foo = Nexmo::SMS->new(
+        server   => 'http://rest.nexmo.com/sms/json',
+        username => 'testuser1',
+        password => 'testpasswd2',
+    );
+
+Those parameters are optional and they are used as defaults for the message objects
+
+=cut
 
 my @attrs = qw(server username password);;
 
@@ -45,6 +84,27 @@ sub new {
     return $self;
 }
 
+=head2 sms
+
+Create a new message object or returns C<undef>.
+
+    my $sms = $nexmo->sms(
+        text     => 'This is a test',
+        from     => 'Test02',
+        to       => '452312432',
+    ) or die $nexmo->errstr;
+
+Send a binary message
+
+    my $binary = $nexmo->sms(
+        type     => 'binary',
+        udh      => '06050415811581',   # hex encoded udh
+        body     => '0011223344556677', # hex encoded body
+        from     => 'Test02',
+        to       => '452312432',
+    ) or die $nexmo->errstr;
+
+=cut
 
 sub sms {
     my ($self,%param) = @_;
@@ -92,6 +152,13 @@ sub sms {
     return $message;
 }
 
+=head2 errstr
+
+return the "last" error as string.
+
+    print $nexmo->errstr;
+
+=cut
 
 sub errstr {
     my ($self,$message) = @_;
@@ -100,6 +167,11 @@ sub errstr {
     return $self->{__errstr__};
 }
 
+=head2 get_balance
+
+  my $balance = $nexmo->get_balance;
+
+=cut
 
 sub get_balance {
     my ($self,%param) = @_;
@@ -115,102 +187,17 @@ sub get_balance {
     return $balance->get_balance;
 }
 
+=head2 get_pricing
+
+Not implemented yet...
+
+=cut
 
 sub get_pricing {
     warn "not implemented yet\n";
     return;
 }
 
-
-1; # End of Nexmo::SMS
-
-__END__
-=pod
-
-=head1 NAME
-
-Nexmo::SMS - Module for the Nexmo SMS API!
-
-=head1 VERSION
-
-version 0.06
-
-=head1 SYNOPSIS
-
-This module simplifies sending SMS through the Nexmo API.
-
-    use Nexmo::SMS;
-
-    my $nexmo = Nexmo::SMS->new(
-        server   => 'http://rest.nexmo.com/sms/json',
-        username => 'testuser1',
-        password => 'testpasswd2',
-    );
-    
-    my $sms = $nexmo->sms(
-        text     => 'This is a test',
-        from     => 'Test02',
-        to       => '452312432',
-    ) or die $nexmo->errstr;
-    
-    my $response = $sms->send || die $sms->errstr;
-    
-    if ( $response->is_success ) {
-        print "SMS was sent...\n";
-    }
-
-=head1 VERSION
-
-Version 0.06
-
-=head1 METHODS
-
-=head2 new
-
-create a new object
-
-    my $foo = Nexmo::SMS->new(
-        server   => 'http://rest.nexmo.com/sms/json',
-        username => 'testuser1',
-        password => 'testpasswd2',
-    );
-
-Those parameters are optional and they are used as defaults for the message objects
-
-=head2 sms
-
-Create a new message object or returns C<undef>.
-
-    my $sms = $nexmo->sms(
-        text     => 'This is a test',
-        from     => 'Test02',
-        to       => '452312432',
-    ) or die $nexmo->errstr;
-
-Send a binary message
-
-    my $binary = $nexmo->sms(
-        type     => 'binary',
-        udh      => '06050415811581',   # hex encoded udh
-        body     => '0011223344556677', # hex encoded body
-        from     => 'Test02',
-        to       => '452312432',
-    ) or die $nexmo->errstr;
-
-=head2 errstr
-
-return the "last" error as string.
-
-    print $nexmo->errstr;
-
-=head2 get_balance
-
-  my $balance = $nexmo->get_balance;
-
-=head2 get_pricing
-
-Not implemented yet...
-
 =head1 Attributes
 
 These attributes are available for C<Nexmo::SMS::TextMessage> objects. For each
@@ -229,66 +216,11 @@ attribute there is a getter/setter:
 
 =back
 
-=head1 AUTHOR
-
-Renee Baecker, C<< <module at renee-baecker.de> >>
-
-=head1 BUGS
-
-Please report any bugs or feature requests to C<bug-nexmo-sms at rt.cpan.org>, or through
-the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Nexmo-SMS>.  I will be notified, and then you'll
-automatically be notified of progress on your bug as I make changes.
-
-=head1 SUPPORT
-
-You can find documentation for this module with the perldoc command.
-
-    perldoc Nexmo::SMS
-
-You can also look for information at:
-
-=over 4
-
-=item * RT: CPAN's request tracker
-
-L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Nexmo-SMS>
-
-=item * AnnoCPAN: Annotated CPAN documentation
-
-L<http://annocpan.org/dist/Nexmo-SMS>
-
-=item * CPAN Ratings
-
-L<http://cpanratings.perl.org/d/Nexmo-SMS>
-
-=item * Search CPAN
-
-L<http://search.cpan.org/dist/Nexmo-SMS/>
-
-=back
-
 =head1 ACKNOWLEDGEMENTS
 
 Jui-Nan Lin added support for Unicode messages, thanks!
 (see https://github.com/reneeb/perl-Nexmo-SMS/pull/1/files)
 
-=head1 COPYRIGHT & LICENSE
-
-Copyright 2011 Renee Baecker.
-
-This program is released under the following license: artistic_2
-
-=head1 AUTHOR
-
-Renee Baecker <module@renee-baecker.de>
-
-=head1 COPYRIGHT AND LICENSE
-
-This software is Copyright (c) 2011 by Renee Baecker.
-
-This is free software, licensed under:
-
-  The Artistic License 2.0 (GPL Compatible)
-
 =cut
 
+1; # End of Nexmo::SMS