| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package WebService::Salesforce::Message; | 
| 2 |  |  |  |  |  |  |  | 
| 3 | 1 |  |  | 1 |  | 20030 | use Moo; | 
|  | 1 |  |  |  |  | 15648 |  | 
|  | 1 |  |  |  |  | 5 |  | 
| 4 | 1 |  |  | 1 |  | 2041 | use XML::LibXML; | 
|  | 0 |  |  |  |  |  |  | 
|  | 0 |  |  |  |  |  |  | 
| 5 |  |  |  |  |  |  | use WebService::Salesforce::Message::Notification; | 
| 6 |  |  |  |  |  |  |  | 
| 7 |  |  |  |  |  |  | our $VERSION = '0.04'; | 
| 8 |  |  |  |  |  |  |  | 
| 9 |  |  |  |  |  |  | has 'xml' => ( is => 'ro', required => 1 ); | 
| 10 |  |  |  |  |  |  |  | 
| 11 |  |  |  |  |  |  | has 'dom' => ( | 
| 12 |  |  |  |  |  |  | is      => 'ro', | 
| 13 |  |  |  |  |  |  | lazy    => 1, | 
| 14 |  |  |  |  |  |  | default => sub { | 
| 15 |  |  |  |  |  |  | my $self = shift; | 
| 16 |  |  |  |  |  |  | XML::LibXML->load_xml( string => $self->xml ); | 
| 17 |  |  |  |  |  |  | } | 
| 18 |  |  |  |  |  |  | ); | 
| 19 |  |  |  |  |  |  |  | 
| 20 |  |  |  |  |  |  | has 'notifications_element' => ( | 
| 21 |  |  |  |  |  |  | is      => 'ro', | 
| 22 |  |  |  |  |  |  | lazy    => 1, | 
| 23 |  |  |  |  |  |  | default => sub { | 
| 24 |  |  |  |  |  |  | my $self                      = shift; | 
| 25 |  |  |  |  |  |  | my ( $node )                  = $self->dom->findnodes( '/soapenv:Envelope/soapenv:Body' ); | 
| 26 |  |  |  |  |  |  | my ( $notifications_element ) = $node->getChildrenByTagName( 'notifications' ); | 
| 27 |  |  |  |  |  |  |  | 
| 28 |  |  |  |  |  |  | return $notifications_element; | 
| 29 |  |  |  |  |  |  |  | 
| 30 |  |  |  |  |  |  | } | 
| 31 |  |  |  |  |  |  | ); | 
| 32 |  |  |  |  |  |  |  | 
| 33 |  |  |  |  |  |  | has 'notifications' => ( | 
| 34 |  |  |  |  |  |  | is      => 'ro', | 
| 35 |  |  |  |  |  |  | lazy    => 1, | 
| 36 |  |  |  |  |  |  | default => sub { | 
| 37 |  |  |  |  |  |  | my $self                  = shift; | 
| 38 |  |  |  |  |  |  | my $notification_elements = $self->notifications_element->getChildrenByTagName( 'Notification' ); | 
| 39 |  |  |  |  |  |  |  | 
| 40 |  |  |  |  |  |  | my @notifications; | 
| 41 |  |  |  |  |  |  | foreach my $notification_element ( @{$notification_elements} ) { | 
| 42 |  |  |  |  |  |  | push @notifications, WebService::Salesforce::Message::Notification->new( { | 
| 43 |  |  |  |  |  |  | notification_element => $notification_element } ); | 
| 44 |  |  |  |  |  |  | } | 
| 45 |  |  |  |  |  |  | return \@notifications; | 
| 46 |  |  |  |  |  |  | } | 
| 47 |  |  |  |  |  |  | ); | 
| 48 |  |  |  |  |  |  |  | 
| 49 |  |  |  |  |  |  | has 'organization_id' => ( | 
| 50 |  |  |  |  |  |  | is      => 'ro', | 
| 51 |  |  |  |  |  |  | lazy    => 1, | 
| 52 |  |  |  |  |  |  | default => sub { | 
| 53 |  |  |  |  |  |  | my $self = shift; | 
| 54 |  |  |  |  |  |  | return $self->notifications_element->getChildrenByTagName( 'OrganizationId' )->[0] | 
| 55 |  |  |  |  |  |  | ->textContent; | 
| 56 |  |  |  |  |  |  | } | 
| 57 |  |  |  |  |  |  | ); | 
| 58 |  |  |  |  |  |  |  | 
| 59 |  |  |  |  |  |  | has 'action_id' => ( | 
| 60 |  |  |  |  |  |  | is      => 'ro', | 
| 61 |  |  |  |  |  |  | lazy    => 1, | 
| 62 |  |  |  |  |  |  | default => sub { | 
| 63 |  |  |  |  |  |  | my $self = shift; | 
| 64 |  |  |  |  |  |  | return $self->notifications_element->getChildrenByTagName( 'ActionId' )->[0] | 
| 65 |  |  |  |  |  |  | ->textContent; | 
| 66 |  |  |  |  |  |  | } | 
| 67 |  |  |  |  |  |  | ); | 
| 68 |  |  |  |  |  |  |  | 
| 69 |  |  |  |  |  |  | has 'session_id' => ( | 
| 70 |  |  |  |  |  |  | is      => 'ro', | 
| 71 |  |  |  |  |  |  | lazy    => 1, | 
| 72 |  |  |  |  |  |  | default => sub { | 
| 73 |  |  |  |  |  |  | my $self = shift; | 
| 74 |  |  |  |  |  |  | return $self->notifications_element->getChildrenByTagName( 'SessionId' )->[0] | 
| 75 |  |  |  |  |  |  | ->textContent; | 
| 76 |  |  |  |  |  |  | } | 
| 77 |  |  |  |  |  |  | ); | 
| 78 |  |  |  |  |  |  |  | 
| 79 |  |  |  |  |  |  | has 'enterprise_url' => ( | 
| 80 |  |  |  |  |  |  | is      => 'ro', | 
| 81 |  |  |  |  |  |  | lazy    => 1, | 
| 82 |  |  |  |  |  |  | default => sub { | 
| 83 |  |  |  |  |  |  | my $self = shift; | 
| 84 |  |  |  |  |  |  | return $self->notifications_element->getChildrenByTagName( 'EnterpriseUrl' )->[0] | 
| 85 |  |  |  |  |  |  | ->textContent; | 
| 86 |  |  |  |  |  |  | } | 
| 87 |  |  |  |  |  |  | ); | 
| 88 |  |  |  |  |  |  |  | 
| 89 |  |  |  |  |  |  | has 'partner_url' => ( | 
| 90 |  |  |  |  |  |  | is      => 'ro', | 
| 91 |  |  |  |  |  |  | lazy    => 1, | 
| 92 |  |  |  |  |  |  | default => sub { | 
| 93 |  |  |  |  |  |  | my $self = shift; | 
| 94 |  |  |  |  |  |  | return $self->notifications_element->getChildrenByTagName( 'PartnerUrl' )->[0] | 
| 95 |  |  |  |  |  |  | ->textContent; | 
| 96 |  |  |  |  |  |  | } | 
| 97 |  |  |  |  |  |  | ); | 
| 98 |  |  |  |  |  |  |  | 
| 99 |  |  |  |  |  |  | has 'ack' => ( | 
| 100 |  |  |  |  |  |  | is      => 'ro', | 
| 101 |  |  |  |  |  |  | default => sub { | 
| 102 |  |  |  |  |  |  | return < | 
| 103 |  |  |  |  |  |  |  | 
| 104 |  |  |  |  |  |  |  | 
| 105 |  |  |  |  |  |  |  | 
| 106 |  |  |  |  |  |  |  | 
| 107 |  |  |  |  |  |  | true | 
| 108 |  |  |  |  |  |  |  | 
| 109 |  |  |  |  |  |  |  | 
| 110 |  |  |  |  |  |  |  | 
| 111 |  |  |  |  |  |  | ACK | 
| 112 |  |  |  |  |  |  | } | 
| 113 |  |  |  |  |  |  | ); | 
| 114 |  |  |  |  |  |  |  | 
| 115 |  |  |  |  |  |  | 1; | 
| 116 |  |  |  |  |  |  |  | 
| 117 |  |  |  |  |  |  | __END__ |