| 1 | package Google::Voice::SMS::Message; | ||
| 2 | |||
| 3 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 1 | ▶ | use Mojo::ByteStream; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | |||
| 8 | 1 | ▶ | use Mojo::Base -base; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | |||
| 10 | 1 | __PACKAGE__->attr([qw/ text time inbound outbound xml rnr_se ua /]); | |
| 11 | |||
| 12 | 0 | ▶ | sub new { |
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 13 | 0 | my $self = bless {}, shift; | |
| 14 | 0 | my $xml = shift; | |
| 15 | 0 | my $meta = shift; | |
| 16 | |||
| 17 | 0 | $self->rnr_se(shift); | |
| 18 | 0 | $self->ua(shift); | |
| 19 | |||
| 20 | 0 | my $from = | |
| 21 | Mojo::ByteStream->new($xml->at('.gc-message-sms-from')->text)->trim; | ||
| 22 | |||
| 23 | 0 | my $time = | |
| 24 | Mojo::ByteStream->new($xml->at('.gc-message-sms-time')->text)->trim; | ||
| 25 | |||
| 26 | 0 | $self->xml($xml); | |
| 27 | 0 | $self->text($xml->at('.gc-message-sms-text')->text); | |
| 28 | 0 | $self->time($time); | |
| 29 | 0 | $self->inbound($from eq 'Me:'); | |
| 30 | 0 | $self->outbound($from ne 'Me:'); | |
| 31 | |||
| 32 | 0 | return $self; | |
| 33 | } | ||
| 34 | |||
| 35 | 1 | 1; | |
| 36 | |||
| 37 | =head1 NAME | ||
| 38 | |||
| 39 | Google::Voice::SMS::Message | ||
| 40 | |||
| 41 | =head1 DESCRIPTION | ||
| 42 | |||
| 43 | One message in an sms conversation | ||
| 44 | |||
| 45 | =head1 USAGE | ||
| 46 | |||
| 47 | print "Inbound message" if $sms_message->inbound; | ||
| 48 | print $sms_message->text; | ||
| 49 | |||
| 50 | =head1 ATTRIBUTES | ||
| 51 | |||
| 52 | =head2 text | ||
| 53 | |||
| 54 | Text content of message | ||
| 55 | |||
| 56 | =head2 inbound | ||
| 57 | |||
| 58 | True/false | ||
| 59 | |||
| 60 | =head2 outbound | ||
| 61 | |||
| 62 | True/false | ||
| 63 | |||
| 64 | =head2 xml | ||
| 65 | |||
| 66 | Raw xml | ||
| 67 | |||
| 68 | =head1 METHODS | ||
| 69 | |||
| 70 | =head2 new | ||
| 71 | |||
| 72 | =cut | ||