GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
Nexmo::SMS::TextMessage(3) User Contributed Perl Documentation Nexmo::SMS::TextMessage(3)

Nexmo::SMS::TextMessage - Module that respresents a text message for the Nexmo SMS API!

version 0.06

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";
    }

Version 0.02

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',

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;

return the "last" error as string.

    print $sms->errstr;

This actually calls the Nexmo SMS API. It returns a Nexmo::SMS::Response object or "undef" (on failure).

   my $sms = Nexmo::SMS::TextMessage->new( ... );
   $sms->send or die $sms->errstr;

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";
  }

These attributes are available for "Nexmo::SMS::TextMessage" objects:
  • client_ref
  • from
  • network_code
  • password
  • server
  • status_report_req
  • text
  • to
  • type
  • username

Copyright 2011 Renee Baecker.

This program is released under the following license: artistic_2

Renee Baecker <module@renee-baecker.de>

This software is Copyright (c) 2011 by Renee Baecker.

This is free software, licensed under:

  The Artistic License 2.0 (GPL Compatible)
2011-12-26 perl v5.32.1

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.